GifWriter

class hcipy.plotting.GifWriter(filename, framerate=15)

Bases: object

A writer of gif files from Matplotlib figures.

Warning

This class used to write out individual frames to a directory, before converting this into a gif file. This is now done internally.

Parameters:
filenamestring

The path and filename of the gif.

framerateinteger

The number of frames per second of the generated gif file.

Attributes Summary

num_frames

Methods Summary

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

Add a frame to the animation.

close()

Close the animation and create the final gif file.

convert()

Convert all frames into a gif file.

Attributes Documentation

num_frames

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 GifWriter.

close()

Close the animation and create the final gif file.

convert()

Convert all frames into a gif file.