2.1.4. drrc.tools.visualization module
Code author: Luk Fleddermann
- class visualization[source]
Bases:
object
Visualtizations of temporally extended two-dimensional data.
- static produce_animation(t: ndarray, x: float, dx: float, fps: int, T_out: int, animation_data: list[ndarray], bounds: list[list[int]] | None = None, names: list[str] = ['test_animation'], plt_shape: tuple[int, int] = (1, 1), Path: str = '/home/runner/work/DRRC/DRRC/Figures/', figure_name: str | None = None, prog_feedback: bool = True, one_cbar: bool = False)[source]
Produces an animation of arbitrary length and resolution from the given data.
- Parameters:
t (np.ndarray) – Time array.
x (float) – Physical total length.
dx (float) – Infinitesimal length.
fps (int) – Frames per second of the animation.
T_out (int) – Length of the animation.
animation_data (list[np.ndarray]) – List of Data of excitation over time. The first dimension is temporal. Different list elements are shown in different figures.
bounds (list[list[int]] | None, optional) – Bounds of the range in the heatmap. Defaults to None. Different list elements are used in different figures.
names (list[str], optional) – Names of the animation. Defaults to [“test_animation”]. Different list elements are used in different figures.
plt_shape (tuple[int, int], optional) – Shape of the plot: (nrows, ncols). Defaults to (1, 1).
Path (str, optional) – Path to the directory where the file is saved. Defaults to f”{Config.get_git_root()}/Figures/”.
figure_name (str | None, optional) – Name of the figure. Defaults to None.
prog_feedback (bool, optional) – Whether to show progress feedback. Defaults to True.
one_cbar (bool, optional) – Whether to show only one colorbar. Defaults to False.
- Returns:
mp4 data
Notes
The function has limited application so far and shall be extended to optionally produce multiple plots next to each other.
- Raises:
TypeError – If animation_data and animation_data2 have different shapes.
- static produce_series_of_snapshots(animation_data_u, frame_nrs, T_tot, bounds=None, format='1x4_only_u', animation_data_w=None, with_heat=None, name=None)[source]
The function produces series of snapshots (heatmaps) for different possibilities of numbers of images, formats, and possibly from different data sets.
- Parameters:
animation_data – Data of excitation over time. First dimension is temporal (three dim np array)
frame_nrs – A list of the numbers of frams which shall be included in the saved figure (array)
T_tot – Physical temporal length of animation (float)
bounds – bounds of the range in heatmap (float array of shape (2,))
format – Specification of the format (Str)
name – name of file, and title of plot (Str)
- Output:
image
Warning
Not maintained! And very old.