@@ -268,7 +268,12 @@ def make_pipeline(session_path, **pkwargs):
268268 compute_status = False
269269 else :
270270 registration_class = btasks .TrialRegisterRaw
271- behaviour_class = btasks .ChoiceWorldTrialsNidq
271+ if sync_args ['sync_namespace' ] == 'timeline' :
272+ behaviour_class = btasks .ChoiceWorldTrialsTimeline
273+ elif sync_args ['sync_namespace' ] in ('spikeglx' , None ):
274+ behaviour_class = btasks .ChoiceWorldTrialsNidq
275+ else :
276+ raise NotImplementedError (f'No trials task available for sync namespace "{ sync_args ["sync_namespace" ]} "' )
272277 compute_status = True
273278 else :
274279 raise NotImplementedError
@@ -278,7 +283,7 @@ def make_pipeline(session_path, **pkwargs):
278283 tasks [f'Trials_{ protocol } _{ i :02} ' ] = type (f'Trials_{ protocol } _{ i :02} ' , (behaviour_class ,), {})(
279284 ** kwargs , ** sync_kwargs , ** task_kwargs , parents = parents )
280285 if compute_status :
281- tasks [f" TrainingStatus_{ protocol } _{ i :02} " ] = type (f'TrainingStatus_{ protocol } _{ i :02} ' , (
286+ tasks [f' TrainingStatus_{ protocol } _{ i :02} ' ] = type (f'TrainingStatus_{ protocol } _{ i :02} ' , (
282287 btasks .TrainingStatus ,), {})(** kwargs , ** task_kwargs , parents = [tasks [f'Trials_{ protocol } _{ i :02} ' ]])
283288
284289 # Ephys tasks
@@ -289,7 +294,10 @@ def make_pipeline(session_path, **pkwargs):
289294 all_probes = []
290295 register_tasks = []
291296 for pname , probe_info in devices ['neuropixel' ].items ():
292- meta_file = spikeglx .glob_ephys_files (Path (session_path ).joinpath (probe_info ['collection' ]), ext = 'meta' )
297+ # Glob to support collections such as _00a, _00b. This doesn't fix the issue of NP2.4
298+ # extractions, however.
299+ probe_collection = next (session_path .glob (probe_info ['collection' ] + '*' ))
300+ meta_file = spikeglx .glob_ephys_files (probe_collection , ext = 'meta' )
293301 meta_file = meta_file [0 ].get ('ap' )
294302 nptype = spikeglx ._get_neuropixel_version_from_meta (spikeglx .read_meta_data (meta_file ))
295303 nshanks = spikeglx ._get_nshanks_from_meta (spikeglx .read_meta_data (meta_file ))
@@ -482,12 +490,15 @@ def get_trials_tasks(session_path, one=None):
482490 # If experiment description file then use this to make the pipeline
483491 if experiment_description is not None :
484492 tasks = []
485- pipeline = make_pipeline (session_path , one = one )
486- trials_tasks = [t for t in pipeline .tasks if 'Trials' in t ]
487- for task in trials_tasks :
488- t = pipeline .tasks .get (task )
489- t .__init__ (session_path , ** t .kwargs )
490- tasks .append (t )
493+ try :
494+ pipeline = make_pipeline (session_path , one = one )
495+ trials_tasks = [t for t in pipeline .tasks if 'Trials' in t ]
496+ for task in trials_tasks :
497+ t = pipeline .tasks .get (task )
498+ t .__init__ (session_path , ** t .kwargs )
499+ tasks .append (t )
500+ except NotImplementedError as ex :
501+ _logger .warning ('Failed to get trials tasks: %s' , ex )
491502 else :
492503 # Otherwise default to old way of doing things
493504 if one and one .to_eid (session_path ):
0 commit comments