w = v.WormPlot(ax, strain='n2', wid=wids[i], time=t + i * 300, time_stamp_offset=34200, trajectory_length=150, trajectory_delta=30, trajectory_size=3, trajectory_cmap=plt.cm.gray_r, stage_stamp_font_size=12, stage_indicator_label_font_size=12, time_stamp=False, time_stamp_font_size=12, border=[[5, 5], [50, 5]]) a = v.WormAnimation( figure=fig, plots=[w], times=[range(w.stage_time_min + 1500 * 300, w.stage_time_max, 300)]) fig.show() #%% a.animate() #%% All worms wids = np.arange(124) wids[90] = 124 # wid = 90 is corrupted data ! # sort via average roaming fraction roaming = exp.load(strain='n2', wid=wids, dtype='roam')
def time_text(time, index): s = (nstages_acc <= index).sum() return '%s %s' % (stage_names[s], v.time_str( (index - istages[s]) * dt)) else: def time_text(time, index): return v.time_str(time) a = v.WormAnimation(figure=fig, plots=plots, times=times, time_stamp=True, time_stamp_text=time_text, time_stamp_font_size=6, save=fname, fps=30, dpi=300) fig.show() #%% a.animate() #%% import os import numpy as np import analysis.experiment as exp
if aligned == 'aligned': nstages_acc = np.cumsum(nstages) stage_names = ['L1', 'L2', 'L3', 'L4', 'A'] def time_text(time, index): s = (nstages_acc <= index).sum() return 'N2 %s %s' % (stage_names[s], v.time_str((index - istages[s]) * delta_t)) else: def time_text(time, index): return 'N2 %s' % v.time_str(time) a = v.WormAnimation(figure=fig, plots=plts, times=times, fps=fps, dpi=360, save=fname, time_stamp=True, time_stamp_font_size=7, time_stamp_text=time_text) fig.show() #%% a.animate()