Skip to content

Commit e933ef6

Browse files
committed
Merge pull request matplotlib#504 from jdh2358/animation_verbose
Add a bit of logging to the animation module
2 parents da25c48 + ba04a30 commit e933ef6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

examples/animation/double_pendulum_animated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ def animate(i):
8484
ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)),
8585
interval=25, blit=True, init_func=init)
8686

87-
#ani.save('double_pendulum.mp4', fps=15, clear_temp=False)
87+
#ani.save('double_pendulum.mp4', fps=15, clear_temp=True)
8888
plt.show()

lib/matplotlib/animation.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# * Need to consider event sources to allow clicking through multiple figures
2222
import itertools
2323
from matplotlib.cbook import iterable
24+
from matplotlib import verbose
2425

2526
class Animation(object):
2627
'''
@@ -120,13 +121,15 @@ def save(self, filename, fps=5, codec='mpeg4', clear_temp=True,
120121
self._draw_next_frame(data, blit=False)
121122
fname = '%s%04d.png' % (frame_prefix, idx)
122123
fnames.append(fname)
124+
verbose.report('Animation.save: saved frame %d to fname=%s'%(idx, fname), level='debug')
123125
self._fig.savefig(fname)
124126

125127
self._make_movie(filename, fps, codec, frame_prefix)
126128

127129
#Delete temporary files
128130
if clear_temp:
129131
import os
132+
verbose.report('Animation.save: clearing temporary fnames=%s'%str(fnames), level='debug')
130133
for fname in fnames:
131134
os.remove(fname)
132135

@@ -155,7 +158,9 @@ def _make_movie(self, fname, fps, codec, frame_prefix, cmd_gen=None):
155158
from subprocess import Popen, PIPE
156159
if cmd_gen is None:
157160
cmd_gen = self.ffmpeg_cmd
158-
proc = Popen(cmd_gen(fname, fps, codec, frame_prefix), shell=False,
161+
command = cmd_gen(fname, fps, codec, frame_prefix)
162+
verbose.report('Animation._make_movie running command: %s'%' '.join(command))
163+
proc = Popen(command, shell=False,
159164
stdout=PIPE, stderr=PIPE)
160165
proc.wait()
161166

0 commit comments

Comments
 (0)