riveSunder / yuca

Your Universal Cellular Automata
MIT License
11 stars 0 forks source link

Benchmark saving animations with `matplotlib.animation.FuncAnimation` #42

Open riveSunder opened 1 year ago

riveSunder commented 1 year ago

Compare matplotlib.animation.FuncAnimation for saving animations to current Pillow-based implementation. Keep the fastest method, or, if they are about the same use the matplotlib functionality.

riveSunder commented 1 year ago

Using matplotlib for animations should be faster, as the current method has more file reads/writes and is generally clunkier. The actual call to save a gif (can also save other file types) can be

matplotlib.animation.FuncAnimation(fig, update_fig, frames=num_frames, interval=100).save("filename.gif")

Where update_fig is a function that iterates some change and updates the figure.

An example of how to do this can be found at https://github.com/riveSunder/SRNCA/blob/master/notebooks/texture_nca.ipynb