@@ -1068,27 +1068,28 @@ class EphysPostDLC(tasks.Task):
10681068 # the following are required for the DLC plot only
10691069 # they are not strictly required, some plots just might be skipped
10701070 # In particular the raw videos don't need to be downloaded as they can be streamed
1071- ('_iblrig_bodyCamera.raw.mp4' , 'raw_video_data' , False ),
1072- ('_iblrig_leftCamera.raw.mp4' , 'raw_video_data' , False ),
1073- ('_iblrig_rightCamera.raw.mp4' , 'raw_video_data' , False ),
1074- ('rightROIMotionEnergy.position.npy' , 'alf' , False ),
1075- ('leftROIMotionEnergy.position.npy' , 'alf' , False ),
1076- ('bodyROIMotionEnergy.position.npy' , 'alf' , False ),
1077- ('_ibl_trials.choice.npy' , 'alf' , False ),
1078- ('_ibl_trials.feedbackType.npy' , 'alf' , False ),
1079- ('_ibl_trials.feedback_times.npy' , 'alf' , False ),
1080- ('_ibl_trials.stimOn_times.npy' , 'alf' , False ),
1081- ('_ibl_wheel.position.npy' , 'alf' , False ),
1082- ('_ibl_wheel.timestamps.npy' , 'alf' , False ),
1071+ ('_iblrig_bodyCamera.raw.mp4' , 'raw_video_data' , True ),
1072+ ('_iblrig_leftCamera.raw.mp4' , 'raw_video_data' , True ),
1073+ ('_iblrig_rightCamera.raw.mp4' , 'raw_video_data' , True ),
1074+ ('rightROIMotionEnergy.position.npy' , 'alf' , True ),
1075+ ('leftROIMotionEnergy.position.npy' , 'alf' , True ),
1076+ ('bodyROIMotionEnergy.position.npy' , 'alf' , True ),
1077+ ('_ibl_trials.choice.npy' , 'alf' , True ),
1078+ ('_ibl_trials.feedbackType.npy' , 'alf' , True ),
1079+ ('_ibl_trials.feedback_times.npy' , 'alf' , True ),
1080+ ('_ibl_trials.stimOn_times.npy' , 'alf' , True ),
1081+ ('_ibl_wheel.position.npy' , 'alf' , True ),
1082+ ('_ibl_wheel.timestamps.npy' , 'alf' , True ),
10831083 ],
10841084 # More files are required for all panels of the DLC QC plot to function
10851085 'output_files' : [('_ibl_leftCamera.features.pqt' , 'alf' , True ),
10861086 ('_ibl_rightCamera.features.pqt' , 'alf' , True ),
10871087 ('licks.times.npy' , 'alf' , True ),
1088- ('dlc_qc_plot.png' , 'snapshot' , False )]
1088+ # ('dlc_qc_plot.png', 'snapshot', False)
1089+ ]
10891090 }
10901091
1091- def _run (self , overwrite = False , run_qc = True , plot_qc = True ):
1092+ def _run (self , overwrite = True , run_qc = True , plot_qc = True ):
10921093 """
10931094 Run the EphysPostDLC task. Returns a list of file locations for the output files in signature. The created plot
10941095 (dlc_qc_plot.png) is not returned, but saved in session_path/snapshots and uploaded to Alyx as a note.
@@ -1121,18 +1122,24 @@ def _run(self, overwrite=False, run_qc=True, plot_qc=True):
11211122 dlc = pd .read_parquet (dlc_file )
11221123 dlc_thresh = likelihood_threshold (dlc , 0.9 )
11231124 # try to load respective camera times
1124- dlc_t = np .load (next (Path (self .session_path ).joinpath ('alf' ).glob (f'_ibl_{ cam } Camera.times.*npy' )))
1125- times = True
1126- if dlc_t .shape [0 ] == 0 :
1127- _logger .error (f'camera.times empty for { cam } camera. '
1128- f'Computations using camera.times will be skipped' )
1125+ try :
1126+ dlc_t = np .load (next (Path (self .session_path ).joinpath ('alf' ).glob (f'_ibl_{ cam } Camera.times.*npy' )))
1127+ times = True
1128+ if dlc_t .shape [0 ] == 0 :
1129+ _logger .error (f'camera.times empty for { cam } camera. '
1130+ f'Computations using camera.times will be skipped' )
1131+ self .status = - 1
1132+ times = False
1133+ elif dlc_t .shape [0 ] < len (dlc_thresh ):
1134+ _logger .error (f'Camera times shorter than DLC traces for { cam } camera. '
1135+ f'Computations using camera.times will be skipped' )
1136+ self .status = - 1
1137+ times = 'short'
1138+ except StopIteration :
11291139 self .status = - 1
11301140 times = False
1131- elif dlc_t .shape [0 ] < len (dlc_thresh ):
1132- _logger .error (f'Camera times shorter than DLC traces for { cam } camera. '
1141+ _logger .error (f'No camera.times for { cam } camera. '
11331142 f'Computations using camera.times will be skipped' )
1134- self .status = - 1
1135- times = 'short'
11361143 # These features are only computed from left and right cam
11371144 if cam in ('left' , 'right' ):
11381145 features = pd .DataFrame ()
@@ -1161,7 +1168,7 @@ def _run(self, overwrite=False, run_qc=True, plot_qc=True):
11611168 output_files .append (features_file )
11621169
11631170 # For all cams, compute DLC qc if times available
1164- if times is True or times == 'short' and run_qc :
1171+ if run_qc is True and times in [ True , 'short' ] :
11651172 # Setting download_data to False because at this point the data should be there
11661173 qc = DlcQC (self .session_path , side = cam , one = self .one , download_data = False )
11671174 qc .run (update = True )
0 commit comments