44from collections import OrderedDict
55
66from ibllib .pipes import tasks , base_tasks
7- from ibllib .pipes .training_preprocessing import (
8- TrainingRegisterRaw , TrainingAudio , TrainingTrials , TrainingDLC , TrainingStatus , TrainingVideoCompress )
7+ import ibllib .pipes .training_preprocessing as tpp
98from ibllib .io .extractors .fibrephotometry import FibrePhotometry
109
1110_logger = logging .getLogger ('ibllib' )
1211
1312
14- class TaskFibrePhotometryRegisterRaw (base_tasks .RegisterRawDataTask ):
13+ class FibrePhotometryRegisterRaw (base_tasks .RegisterRawDataTask ):
1514
1615 priority = 100
1716 job_size = 'small'
1817
1918 def __init__ (self , * args , ** kwargs ):
2019 super ().__init__ (* args , ** kwargs )
2120 self .collection = self .get_task_collection (kwargs .get ('collection' , None ))
21+ self .device_collection = self .get_device_collection ('photometry' , device_collection = 'raw_photometry_data' )
2222
2323 @property
2424 def signature (self ):
2525 signature = {
2626 'input_files' : [],
27- 'output_files' : [('_mcc_DAQdata.raw.tdms' , self .collection , True ),
28- ('_neurophotometrics_fpData.raw.pqt' , self .collection , True )]
27+ 'output_files' : [('_mcc_DAQdata.raw.tdms' , self .device_collection , True ),
28+ ('_neurophotometrics_fpData.raw.pqt' , self .device_collection , True )]
2929 }
3030 return signature
3131
3232
33- class TaskFibrePhotometryPreprocess (base_tasks .DynamicTask ):
34- signature = {
35- 'input_files' : [('*fpData.raw*' , 'raw_photometry_data' , True ), ],
36- 'output_files' : [('photometry.signal.pqt' , 'alf' , True ), ]
37- }
33+ class FibrePhotometryPreprocess (base_tasks .DynamicTask ):
34+ @property
35+ def signature (self ):
36+ signature = {
37+ 'input_files' : [('_mcc_DAQdata.raw.tdms' , self .device_collection , True ),
38+ ('_neurophotometrics_fpData.raw.pqt' , self .device_collection , True )],
39+ 'output_files' : [('photometry.signal.pqt' , 'alf/photometry' , True )]
40+ }
41+ return signature
42+
3843 priority = 90
3944 level = 1
4045
4146 def __init__ (self , session_path , regions = None , ** kwargs ):
4247 super ().__init__ (session_path , ** kwargs )
4348 # Task collection (this needs to be specified in the task kwargs)
4449 self .collection = self .get_task_collection (kwargs .get ('collection' , None ))
50+ self .device_collection = self .get_device_collection ('photometry' , device_collection = 'raw_photometry_data' )
4551 self .regions = regions
4652
4753 def _run (self , ** kwargs ):
48- _ , out_files = FibrePhotometry (self .session_path , collection = self .collection ).extract (
49- regions = self .regions , save = True )
54+ _ , out_files = FibrePhotometry (self .session_path , collection = self .device_collection ).extract (
55+ regions = self .regions , path_out = self . session_path . joinpath ( 'alf' , 'photometry' ), save = True )
5056 return out_files
5157
5258
@@ -63,13 +69,13 @@ def __init__(self, session_path=None, **kwargs):
6369 tasks = OrderedDict ()
6470 self .session_path = session_path
6571 # level 0
66- tasks ['TrainingRegisterRaw' ] = TrainingRegisterRaw (self .session_path )
67- tasks ['TrainingTrials' ] = TrainingTrials (self .session_path )
68- tasks ['TrainingVideoCompress' ] = TrainingVideoCompress (self .session_path )
69- tasks ['TrainingAudio' ] = TrainingAudio (self .session_path )
72+ tasks ['TrainingRegisterRaw' ] = tpp . TrainingRegisterRaw (self .session_path )
73+ tasks ['TrainingTrials' ] = tpp . TrainingTrials (self .session_path )
74+ tasks ['TrainingVideoCompress' ] = tpp . TrainingVideoCompress (self .session_path )
75+ tasks ['TrainingAudio' ] = tpp . TrainingAudio (self .session_path )
7076 # level 1
71- tasks ['BiasedFibrePhotometry' ] = TaskFibrePhotometryPreprocess (self .session_path , parents = [tasks ['TrainingTrials' ]])
72- tasks ['TrainingStatus' ] = TrainingStatus (self .session_path , parents = [tasks ['TrainingTrials' ]])
73- tasks ['TrainingDLC' ] = TrainingDLC (
77+ tasks ['BiasedFibrePhotometry' ] = FibrePhotometryPreprocess (self .session_path , parents = [tasks ['TrainingTrials' ]])
78+ tasks ['TrainingStatus' ] = tpp . TrainingStatus (self .session_path , parents = [tasks ['TrainingTrials' ]])
79+ tasks ['TrainingDLC' ] = tpp . TrainingDLC (
7480 self .session_path , parents = [tasks ['TrainingVideoCompress' ]])
7581 self .tasks = tasks
0 commit comments