def __init__(self, plots, times,
time_stamp = True,
time_stamp_text = time_stamp_text, time_stamp_font_size = 1, time_stamp_color = 'k', time_stamp_position = None,
figure = None,
save = None, dpi = 300, fps = 30,
pause = None, verbose = True):
self.plots = plots;
self.times = times;
if figure is None:
self.figure = plt.gcf();
else:
self.figure = figure;
self.pause = pause;
# time stamp text
if time_stamp:
self.time_stamp_text = time_stamp_text;
tt = time_stamp_text(0,0);
if time_stamp_position is None:
self.time_stamp = figure.suptitle(tt, fontsize = time_stamp_font_size, color = time_stamp_color);
else:
self.time_stamp = plt.annotate(tt, time_stamp_position, xycoords = 'figure fraction',
verticalalignment = 'center', horizontalalignment = 'left',
fontsize = time_stamp_font_size, color = time_stamp_color);
else:
self.time_stamp = None;
# movie saver
if save is not None:
FFMpegWriter = manimation.writers['ffmpeg']
#FFMpegWriter = manimation.writers['mencoder']
metadata = dict(title='Strain %s Worm %d', artist='Chirstoph Kirst',
comment='C Elegans Dataset, Bargmann Lab')
self.writer = FFMpegWriter(fps=fps, metadata=metadata);
self.writer.setup(self.figure, save, dpi = dpi);
else:
self.writer = None;
self.time_id = np.argmax(times[:,-1]);
评论列表
文章目录