@@ -268,7 +268,12 @@ def make_pipeline(session_path, **pkwargs):
268
268
compute_status = False
269
269
else :
270
270
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" ]} "' )
272
277
compute_status = True
273
278
else :
274
279
raise NotImplementedError
@@ -278,7 +283,7 @@ def make_pipeline(session_path, **pkwargs):
278
283
tasks [f'Trials_{ protocol } _{ i :02} ' ] = type (f'Trials_{ protocol } _{ i :02} ' , (behaviour_class ,), {})(
279
284
** kwargs , ** sync_kwargs , ** task_kwargs , parents = parents )
280
285
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} ' , (
282
287
btasks .TrainingStatus ,), {})(** kwargs , ** task_kwargs , parents = [tasks [f'Trials_{ protocol } _{ i :02} ' ]])
283
288
284
289
# Ephys tasks
@@ -289,7 +294,10 @@ def make_pipeline(session_path, **pkwargs):
289
294
all_probes = []
290
295
register_tasks = []
291
296
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' )
293
301
meta_file = meta_file [0 ].get ('ap' )
294
302
nptype = spikeglx ._get_neuropixel_version_from_meta (spikeglx .read_meta_data (meta_file ))
295
303
nshanks = spikeglx ._get_nshanks_from_meta (spikeglx .read_meta_data (meta_file ))
@@ -482,12 +490,15 @@ def get_trials_tasks(session_path, one=None):
482
490
# If experiment description file then use this to make the pipeline
483
491
if experiment_description is not None :
484
492
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 )
491
502
else :
492
503
# Otherwise default to old way of doing things
493
504
if one and one .to_eid (session_path ):
0 commit comments