@@ -111,10 +111,12 @@ def load_data(self, download=False):
111111 self .data .camera_times = {vidio .label_from_path (url ): ts for ts , url in zip (cam .data , cam .url )}
112112 else :
113113 alf_path = self .session_path / 'alf'
114- self .data .wheel = alfio .load_object (alf_path , 'wheel' , short_keys = True )
115- self .data .trials = alfio .load_object (alf_path , 'trials' )
114+ wheel_path = next (alf_path .rglob ('*wheel.timestamps*' )).parent
115+ self .data .wheel = alfio .load_object (wheel_path , 'wheel' , short_keys = True )
116+ trials_path = next (alf_path .rglob ('*trials.table*' )).parent
117+ self .data .trials = alfio .load_object (trials_path , 'trials' )
116118 self .data .camera_times = {vidio .label_from_path (x ): alfio .load_file_content (x ) for x in
117- alf_path .glob ('*Camera.times*' )}
119+ alf_path .rglob ('*Camera.times*' )}
118120 assert all (x is not None for x in self .data .values ())
119121
120122 def _set_eid_or_path (self , session_path_or_eid ):
@@ -428,14 +430,16 @@ def fix_keys(alf_object):
428430 return ob
429431
430432 alf_path = self .session_path .joinpath ('alf' )
431- wheel = (fix_keys (alfio .load_object (alf_path , 'wheel' )) if location == 'SDSC' else alfio .load_object (alf_path , 'wheel' ))
433+ wheel_path = next (alf_path .rglob ('*wheel.timestamps*' )).parent
434+ wheel = (fix_keys (alfio .load_object (wheel_path , 'wheel' )) if location == 'SDSC'
435+ else alfio .load_object (wheel_path , 'wheel' ))
432436 self .wheel_timestamps = wheel .timestamps
433437 # Compute interpolated wheel position and wheel times
434438 wheel_pos , self .wheel_time = wh .interpolate_position (wheel .timestamps , wheel .position , freq = 1000 )
435439 # Compute wheel velocity
436440 self .wheel_vel , _ = wh .velocity_filtered (wheel_pos , 1000 )
437441 # Load in original camera times
438- self .camera_times = alfio .load_file_content (next (alf_path .glob (f'_ibl_{ self .label } Camera.times*.npy' )))
442+ self .camera_times = alfio .load_file_content (next (alf_path .rglob (f'_ibl_{ self .label } Camera.times*.npy' )))
439443 self .camera_path = str (next (self .session_path .joinpath ('raw_video_data' ).glob (f'_iblrig_{ self .label } Camera.raw*.mp4' )))
440444 self .camera_meta = vidio .get_video_meta (self .camera_path )
441445
@@ -473,8 +477,8 @@ def fix_keys(alf_object):
473477 # We attempt to load in some behavior data (trials and dlc). This is only needed for the summary plots, having
474478 # trial aligned paw velocity (from the dlc) is a nice sanity check to make sure the alignment went well
475479 try :
476- self .trials = alfio .load_file_content (next (alf_path .glob ('_ibl_trials.table*.pqt' )))
477- self .dlc = alfio .load_file_content (next (alf_path .glob (f'_ibl_{ self .label } Camera.dlc*.pqt' )))
480+ self .trials = alfio .load_file_content (next (alf_path .rglob ('_ibl_trials.table*.pqt' )))
481+ self .dlc = alfio .load_file_content (next (alf_path .rglob (f'_ibl_{ self .label } Camera.dlc*.pqt' )))
478482 self .dlc = likelihood_threshold (self .dlc )
479483 self .behavior = True
480484 except (ALFObjectNotFound , StopIteration ):
0 commit comments