xopto.util.animation.common module¶
- create_frame_animation(frames: numpy.ndarray, filename: Optional[str] = None, overwrite=False, logscale=False, fps: Optional[float] = None, duration: Optional[float] = None, xlabel=None, ylabel=None, title: Optional[str] = None, axis_off: bool = False, tight_layout: bool = False, cbar: bool = False, cbar_label: Optional[str] = None, cbar_tick_format: Optional[str] = None, cmap: Optional[str] = None, extent: Optional[Tuple[float, float, float, float]] = None, xrange: Optional[Tuple[float, float]] = None, yrange: Optional[Tuple[float, float]] = None, autoscale: bool = True, imshow_kwargs: Optional[dict] = None, writer: Optional[str] = None, dpi: Optional[int] = None, verbose: bool = False) → matplotlib.animation.FuncAnimation[source]¶
Creates a continuous animation of frames.
- Parameters
data (np.ndarray) – A 3D array of frames organized as [frame, y, x].
filename (str) – Output file for the animation.
overwrite (bool) – If False, existing animation files will not be overwritten.
logscale (bool) – If True, logarithmically scale the frame data.
fps (float) – Frame rate of the animation (1/s). Another way to control the frame rate is specify the duration parameter.
duration (float) – Duration of one full animation (s). The same effect can be achieved with the fps parameter.
title (str) – Plot title.
xlabel (str) – Plot x axis label.
ylabel (str) – Plot y axis label.
axis_off (bool) – Turns off the axis and related labels.
tight_layout (bool) – Apply tight layout to the plot.
cbar (bool) – Show a colorbar.
cbar_label (str) – Text displayed by the colorbar label.
cbar_tick_format (str) – Colorbar tick format string.
cmap (str) – Colormap of the image.
extent (Tuple[float, float, float]) – Size of the frame as [xmin, xmax, ymin, ymax].
xrange (Tuple[float, float]) – Range of the x axis as (xmin, xmax).
yrange (Tuple[float, float]) – Range of the y axis as (ymin, ymax).
autoscale (bool) – Independently autoscale the intensity of each frame.
writer (str or mpl.animation.MovieWriter) – Movie writer.
imshow_kwargs (dict) – Additional keyword arguments for pyplot.imshow.
dpi (int) – Resolution of the exported images.
verbose (bool) – Turns on verbose progress report.
- Returns
animation – Animation object.
- Return type
FuncAnimation
- create_path_animation(x: numpy.ndarray, y: numpy.ndarray, filename: Optional[str] = None, overwrite=False, logscale=False, fps: Optional[float] = None, duration: Optional[float] = None, xlabel=None, ylabel=None, title: Optional[str] = None, axis_off: bool = False, tight_layout: bool = False, xrange: Optional[Tuple[float, float]] = None, yrange: Optional[Tuple[float, float]] = None, plot_kwargs: Optional[dict] = None, writer: Optional[str] = None, verbose: bool = False) → matplotlib.animation.FuncAnimation[source]¶
Creates a continuous animation of the paths specified in the x and y arrays.
- Parameters
x (np.ndarray) – X coordinates of the path as a vector or a 2D array of shape (num_paths, path_length) or (1, path_length) or (path_length,).
y (np.ndarray) – Y coordinates of the path as a vector or a 2D array of shape (num_paths, path_length) or (path_length,).
filename (str) – Output file for the animation.
overwrite (bool) – If False, existing animation files will not be overwritten.
logscale (bool) – If True, logarithmically scale the data.
fps (float) – Frame rate of the animation (1/s). Another way to control the frame rate is specify the duration parameter.
duration (float) – Duration of one full animation (s). The same effect can be achieved with the fps parameter.
title (str) – Plot title.
xlabel (str) – Plot x axis label.
ylabel (str) – Plot y axis label.
axis_off (bool) – Turns off the axis and related labels.
tight_layout (bool) – Apply tight layout to the plot.
xrange (Tuple[float, float]) – Range of the x axis as (xmin, xmax).
yrange (Tuple[float, float]) – Range of the y axis as (ymin, ymax).
writer (str or mpl.animation.MovieWriter) – Movie writer.
plot_kwargs (dict) – Additional keyword arguments for pyplot.plot.
verbose (bool) – Turns on verbose progress report.
- Returns
animation – Animation object.
- Return type
FuncAnimation