@@ -1073,25 +1073,19 @@ class SessionLoader:
10731073 pupil : pd .DataFrame = field (default_factory = pd .DataFrame , repr = False )
10741074
10751075 def __post_init__ (self ):
1076- # Providing no session path, eid and one are required
1077- if self . session_path is None or self . session_path == '' :
1078- if self . one and self . eid != '' and self . eid is not None :
1079- self . session_path = self . one . eid2path ( self . eid )
1080- else :
1081- raise ValueError ( "If no session path is given, one and eid are required." )
1082- # Providing a session path
1076+ if self . one is None :
1077+ raise ValueError ( "An input to one is required. If not connection to a database is desired, it can be "
1078+ "a fully local instance of One." )
1079+ # If session path is given, takes precedence over eid
1080+ if self . session_path is not None and self . session_path != '' :
1081+ self . eid = self . one . to_eid ( self . session_path )
1082+ # Providing no session path, try to infer from eid
10831083 else :
1084- if self .one :
1085- self .eid = self .one .to_eid (self .session_path )
1084+ if self .eid is not None and self . eid != '' :
1085+ self .session_path = self .one .eid2path (self .eid )
10861086 else :
1087- # If no one is given, create from cache fully local
1088- self .session_path = Path (self .session_path )
1089- self .one = One (cache_dir = self .session_path .parents [2 ], mode = 'local' )
1090- df_sessions = cache ._make_sessions_df (self .session_path )
1091- self .one ._cache ['sessions' ] = df_sessions .set_index ('id' )
1092- self .one ._cache ['datasets' ] = cache ._make_datasets_df (self .session_path , hash_files = False )
1093- self .eid = str (self .session_path .relative_to (self .session_path .parents [2 ]))
1094- # Information of data that is and can be loaded
1087+ raise ValueError ("If no session path is given, eid is required." )
1088+
10951089 data_names = [
10961090 'trials' ,
10971091 'wheel' ,
@@ -1239,7 +1233,6 @@ def align_trials_to_event(self, align_event='stimOn_times', pre_event=0.5, post_
12391233 _logger .warning (f'{ sum (diffs [:- 1 ] > 0 )} trials overlapping, try reducing pre_event, post_event or both!' )
12401234
12411235 def _check_video_timestamps (self , view , video_timestamps , video_data ):
1242- pose_raw = self .one .load_object (self .eid , f'{ view } Camera' , attribute = ['dlc' , 'times' ])
12431236 # If camera times are shorter than video data, or empty, no current fix
12441237 if video_timestamps .shape [0 ] < video_data .shape [0 ]:
12451238 if video_timestamps .shape [0 ] == 0 :
0 commit comments