stormvogel.extensions.gifs¶
Create gifs from stormvogel models.
Functions¶
|
Render a stormvogel model to a gif. |
|
Embed a gif in a Jupyter notebook so that it also works with Sphinx docs. |
Module Contents¶
- stormvogel.extensions.gifs.render_model_gif(model: stormvogel.model.Model, state_to_image: Callable[[stormvogel.model.State], PIL.Image.Image], scheduler: stormvogel.result.Scheduler | Callable[[stormvogel.model.State], stormvogel.model.Action] | None = None, path: stormvogel.simulator.Path | None = None, filename: str = 'my_gif', max_length: int = 50, fps: int = 2, loop: int = 0) str¶
Render a stormvogel model to a gif.
Use scheduler to pick actions; leave as
Nonefor random actions.- Parameters:
model – Stormvogel model.
state_to_image – Function that takes a state and returns an image.
scheduler – Scheduler to use for the simulation.
path – Path to use for the simulation. If both scheduler and path are set, path takes precedence.
filename – The gif will be saved as
gifs/<filename>.gif.max_length – Maximum number of steps to simulate.
fps – Frames per second of the gif.
loop – Number of times the gif loops.
0means infinite.
- Returns:
Filesystem path of the saved gif.
- stormvogel.extensions.gifs.embed_gif(filename: str)¶
Embed a gif in a Jupyter notebook so that it also works with Sphinx docs.
- Parameters:
filename – Path to the gif file.