gerg_plotting.plotting_classes.animator#

Module Contents#

class gerg_plotting.plotting_classes.animator.Animator#

A class for creating animations (GIFs) from a sequence of images generated by a plotting function.

This class handles both in-memory and disk-based frame generation depending on the number of frames, optimizing memory usage for larger animations.

Parameters#

image_dpiint, optional

Resolution (dots per inch) for saved images, default is 300

Attributes#

plotting_functionCallable

Function used to generate each frame

param_listlist[dict]

List of parameter dictionaries for each frame

num_iterationsint

Total number of frames to generate

durationint | float

Duration of each frame in milliseconds

frameslist

List to store generated frames in memory

gif_filenamePath

Output path for the generated GIF

images_pathPath

Directory for temporary image storage

image_fileslist

List of generated image file paths

function_kwargsdict

Additional arguments for the plotting function

animate(plotting_function, param_dict, gif_filename: str, fps=24, **kwargs) None#

Create and save a GIF animation.

Parameters#

plotting_functionCallable

Function that generates each frame

param_dictdict

Dictionary of parameters for frame generation

gif_filenamestr

Output path for the GIF

fpsint, optional

Frames per second, default is 24

**kwargs

Additional arguments passed to plotting_function

duration: int | float#
frames: list#
function_kwargs: dict#
gif_filename: pathlib.Path#
image_dpi: int#
image_files: list#
images_path: pathlib.Path#
iteration_param: str#
num_iterations: int#
param_list: list[dict]#
plotting_function: Callable#