dantro.plot_creators._movie_writers module

This module implements Movie Writer utilities

class dantro.plot_creators._movie_writers.FileWriter(*, name_padding: int = 7, fstr: str = '{dir:}/{num:0{pad:}d}.{ext:}')[source]

Bases: matplotlib.animation.AbstractMovieWriter

A matplotlib file writer

It adheres to the corresponding matplotlib animation interface.

__init__(*, name_padding: int = 7, fstr: str = '{dir:}/{num:0{pad:}d}.{ext:}')[source]

Initialize a FileWriter, which adheres to the matplotlib.animation interface and can be used to write individual files.

Parameters
  • name_padding (int, optional) – How wide the numbering should be

  • fstr (str, optional) – The format string to generate the name

setup()[source]

Called when entering the saving context

finish()[source]

Called when finished

classmethod isAvailable() → bool[source]

Always available.

saving(fig, base_outfile: str, dpi: int = None, **setup_kwargs)[source]

Create an instance of the context manager

Parameters
  • fig (matplotlib.Figure) – The figure object to save

  • base_outfile (str) – The path this movie writer would store a movie file at; the file name will be interpreted as the name of the directory that the frames are saved to; the file extension is retained.

  • dpi (int, optional) – The desired densiy

  • **setup_kwargs – Passed to setup method

Returns

this object, which also is a context manager.

Return type

FileWriter

grab_frame(**savefig_kwargs)[source]

Stores a single frame

__enter__()[source]

Called when entering context.

Makes sure that the output directory exists.

__exit__(*args)[source]

Called when exiting context.

Closes the figure.

_abc_impl = <_abc_data object>
property frame_size

A tuple (width, height) in pixels of a movie frame.