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: Module

Create 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)

collect_figures()

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.

p_make_figure()

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_module

The differentiation module to be used by this module.

grid

The grid of the model settings

info

Return a dictionary with information about the time stepper.

interp_module

The interpolation module to be used by this module.

mset

The model settings

name

required_halo

Examples using fridom.framework.modules.animation.VideoWriter#

Barotropic Jet

Barotropic Jet

Reflecting Wave Package

Reflecting Wave Package

Internal Gravity Wave Maker

Internal Gravity Wave Maker

Convection and Closures

Convection and Closures

Multiple Wave Makers

Multiple Wave Makers

Rayleigh-Taylor Instability

Rayleigh-Taylor Instability

Rayleigh-Bénard Convection

Rayleigh-Bénard Convection

Single Internal Wave

Single Internal Wave

Dancing Eddies

Dancing Eddies

Symmetric Instability

Symmetric Instability

Tracers and Eddies

Tracers and Eddies

Barotropic Instability

Barotropic Instability
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.

start()[source]#

Method to start the writer process.

stop()[source]#

Method to stop the writer process.

update(mz: ModelState) ModelState[source]#

Update method of the parallel animated model.

parallel_update(mz: ModelState)[source]#
single_update(mz: ModelState)[source]#
collect_figures()[source]#
show_video(width=600)[source]#
p_make_figure()[source]#

Parallel function that gets a ModelPlotter object, makes the image of it and puts it in the output queue.

Arguments:

modelplot (ModelPlotter): model plotter object output_queue (mp.Queue) : output queue