Coverage for /builds/kinetik161/ase/ase/io/animation.py: 100.00%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
1from ase.visualize.plot import animate
4def write_animation(filename, images, writer=None,
5 interval=200,
6 save_count=None, # ignored for newer matplotlib (2023)
7 save_parameters=None, ax=None, **kwargs):
8 import matplotlib.pyplot as plt
10 if save_parameters is None:
11 save_parameters = {}
13 if ax is None:
14 ax = plt.gca()
16 animation = animate(images, ax=ax,
17 interval=interval,
18 **kwargs)
19 animation.save(filename, writer=writer,
20 **save_parameters)
23# Shortcuts for ase.io.formats (guessing file type from extension):
24write_gif = write_animation
25write_mp4 = write_animation