VideoWriter#
- class fridom.framework.modules.animation.video_writer.VideoWriter(model_plotter: 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.
- parallelbool, 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: 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()Disable the module.
enable()Enable the module.
is_enabled()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[, setup_mode])Set the module up.
show_video([width])single_update(mz)start()Start the module.
stop()Stop the module.
update(mz)Update the model state.
Attributes
diff_moduleThe differentiation module to be used by this module.
gridThe grid of the model settings.
Return a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
is_setupWhether the module is set up.
msetThe model settings.
required_haloThe required halo points for this module.
Examples using
fridom.framework.modules.animation.VideoWriter#- name = 'Video Writer'#
- start() None[source]#
Start the module.
Description#
This method is called at the beginning of the model run. Child classes that require a start method (for example to start an output writer) should overwrite this method. Make sure to decorate the method with the @module_method decorator.
- stop() None[source]#
Stop the module.
Description#
This method is called by the model at the end of the model run or when the model is reset. Child classes that require a stop method (for example to close an output file) should overwrite this method. Make sure to decorate the method with the @module_method decorator.
- update(mz: ModelState) ModelState[source]#
Update the model state.
Description#
This method is called by the model at each time step. Child classes should overwrite this method to update the module. Make sure to decorate the method with the @module_method decorator.
Parameters#
- mzfr.ModelState
The model state at the current time step.
Returns#
- fr.ModelState
The updated model state.
- parallel_update(mz: ModelState) None[source]#
- single_update(mz: ModelState) None[source]#