@@ -42,7 +42,7 @@ def find_nearest(array, value):
4242class MotionAlignment :
4343 roi = {'left' : ((800 , 1020 ), (233 , 1096 )), 'right' : ((426 , 510 ), (104 , 545 )), 'body' : ((402 , 481 ), (31 , 103 ))}
4444
45- def __init__ (self , eid = None , one = None , log = logging .getLogger (__name__ ), ** kwargs ):
45+ def __init__ (self , eid = None , one = None , log = logging .getLogger (__name__ ), stream = False , ** kwargs ):
4646 self .one = one or ONE ()
4747 self .eid = eid
4848 self .session_path = kwargs .pop ('session_path' , None ) or self .one .eid2path (eid )
@@ -51,7 +51,10 @@ def __init__(self, eid=None, one=None, log=logging.getLogger(__name__), **kwargs
5151 self .trials = self .wheel = self .camera_times = None
5252 raw_cam_path = self .session_path .joinpath ('raw_video_data' )
5353 camera_path = list (raw_cam_path .glob ('_iblrig_*Camera.raw.*' ))
54- self .video_paths = {vidio .label_from_path (x ): x for x in camera_path }
54+ if stream :
55+ self .video_paths = vidio .url_from_eid (self .eid )
56+ else :
57+ self .video_paths = {vidio .label_from_path (x ): x for x in camera_path }
5558 self .data = Bunch ()
5659 self .alignment = Bunch ()
5760
@@ -107,8 +110,8 @@ def load_data(self, download=False):
107110 if download :
108111 self .data .wheel = self .one .load_object (self .eid , 'wheel' )
109112 self .data .trials = self .one .load_object (self .eid , 'trials' )
110- cam = self .one .load (self .eid , ['camera .times' ], dclass_output = True )
111- self .data .camera_times = {vidio .label_from_path (url ): ts for ts , url in zip (cam . data , cam . url )}
113+ cam , det = self .one .load_datasets (self .eid , ['*Camera .times*' ] )
114+ self .data .camera_times = {vidio .label_from_path (d [ 'rel_path' ] ): ts for ts , d in zip (cam , det )}
112115 else :
113116 alf_path = self .session_path / 'alf'
114117 wheel_path = next (alf_path .rglob ('*wheel.timestamps*' )).parent
@@ -329,7 +332,7 @@ def animate(i):
329332 data ['im' ].set_data (frame )
330333
331334 mkr = find_nearest (wheel .timestamps [wheel_mask ], t_x )
332- data ['marker' ].set_data (wheel .timestamps [wheel_mask ][mkr ], wheel .position [wheel_mask ][mkr ])
335+ data ['marker' ].set_data ([ wheel .timestamps [wheel_mask ][mkr ]], [ wheel .position [wheel_mask ][mkr ] ])
333336
334337 return data ['im' ], data ['ln' ], data ['marker' ]
335338
0 commit comments