FrameWriter

class hcipy.plotting.FrameWriter(path, framerate=15, filename='{:05d}.png')

Bases: object

A writer of frames from Matplotlib figures.

This class writes out individual frames to the specified directory. No animation will be created for these frames.

Parameters:
pathstring

The directory to which to write all frames. This path will be created if it does not exist.

framerateinteger

Ignored, but provided for cohesion with other animation writers.

filenamestring

The filename for each of the frames. This will be formatted using filename.format(frame_number). Default: ‘{:05d}.png’.

Methods Summary

add_frame([fig, data, cmap, dpi])

Add a frame to the animation.

close()

Closes the animation writer.

Methods Documentation

add_frame(fig=None, data=None, cmap=None, dpi=None)

Add a frame to the animation.

Parameters:
figMatplotlib figure

The Matplotlib figure acting as the animation frame.

datandarray

The image data array acting as the animation frame.

cmapMatplotlib colormap

The optional colormap for the image data.

dpiinteger or None

The number of dots per inch with which to save the matplotlib figure. If it is not given, the default Matplotlib dpi will be used.

Raises:
RuntimeError

If the function was called on a closed FrameWriter.

close()

Closes the animation writer.

Makes sure that no more frames can be written to the directory.