VideoWriter#
- class fridom.framework.modules.animation.video_writer.VideoWriter(model_plotter: fr.ModelPlotter, model_time_per_second: timedelta64 | float, filename: str = 'output.mp4', fps: int = 30, parallel: bool = True, max_jobs: float = 0.2)[source]#
Bases:
ModuleCreate a mp4 video from the model.
Description#
To create a mp4 video from the model, one must provide a ModelPlotter that will be used to create the figure. The video writer does not support MPI parallelism.
Parameters#
- model_plotterModelPlotter
The model plotter that will be used to create the figure.
- write_intervalnp.timedelta64 | float
The interval at which the data should be written to the file.
- filenamestr, optional (default=”output.mp4”)
The filename of the video (will be stored in videos/filename).
- fpsint, optional (default=30)
The frames per second of the video.
- ‘parallel’bool, optional (default=True)
If True, the video writer will use parallelism to create the video.
- max_jobsfloat, optional (default=0.4)
The maximum fraction of the available threads that will be used.
- __init__(model_plotter: fr.ModelPlotter, model_time_per_second: timedelta64 | float, filename: str = 'output.mp4', fps: int = 30, parallel: bool = True, max_jobs: float = 0.2) None[source]#
Methods
__init__(model_plotter, model_time_per_second)disable()Enabling the module means that it will be executed at each time step.
enable()Enabling the module means that it will be executed at each time step.
is_enabled()Return whether the module is enabled or not.
Parallel function that gets a ModelPlotter object, makes the image of it and puts it in the output queue.
parallel_update(mz)reset()Stop and start the module.
setup(mset)Start the module
show_video([width])single_update(mz)start()Method to start the writer process.
stop()Method to stop the writer process.
update(mz)Update method of the parallel animated model.
Attributes
diff_moduleThe differentiation module to be used by this module.
gridThe grid of the model settings
infoReturn a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
msetThe model settings
required_haloExamples using
fridom.framework.modules.animation.VideoWriter#- name = 'Video Writer'#
- setup(mset: ModelSettingsBase) None[source]#
Start the module
Description#
This method is called by the ModelSettings.setup() and sets the ModelSettings as well as the differentiation and interpolation modules.
- update(mz: ModelState) ModelState[source]#
Update method of the parallel animated model.
- parallel_update(mz: ModelState)[source]#
- single_update(mz: ModelState)[source]#