From 06d65eaf9356aca3d921ae92f3f6d3bd7da25fce Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Mon, 6 Nov 2023 12:45:20 +0200 Subject: [PATCH] QC notes and test fix --- ibllib/qc/task_metrics.py | 12 ++++++++---- ibllib/tests/qc/test_task_metrics.py | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ibllib/qc/task_metrics.py b/ibllib/qc/task_metrics.py index dd2d3d2b9..7709960e3 100644 --- a/ibllib/qc/task_metrics.py +++ b/ibllib/qc/task_metrics.py @@ -429,7 +429,8 @@ def check_stimOn_goCue_delays(data, audio_output='harp', **_): Notes ----- - For non-harp soundcards the permissible delay is 0.053s + For non-harp sound card the permissible delay is 0.053s. This was chosen by taking the 99.5th + percentile of delays over 500 training sessions using the Xonar soundcard. """ # Calculate the difference between stimOn and goCue times. # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. @@ -453,7 +454,8 @@ def check_response_feedback_delays(data, audio_output='harp', **_): Notes ----- - For non-harp soundcards the permissible delay is 0.053s + For non-harp sound card the permissible delay is 0.053s. This was chosen by taking the 99.5th + percentile of delays over 500 training sessions using the Xonar soundcard. """ threshold = 0.01 if audio_output.lower() == 'harp' else 0.053 metric = np.nan_to_num(data['feedback_times'] - data['response_times'], nan=np.inf) @@ -908,7 +910,8 @@ def check_goCue_delays(data, audio_output='harp', **_): Notes ----- - For non-harp soundcards the permissible delay is 0.053s + For non-harp sound card the permissible delay is 0.053s. This was chosen by taking the 99.5th + percentile of delays over 500 training sessions using the Xonar soundcard. """ threshold = 0.0015 if audio_output.lower() == 'harp' else 0.053 metric = np.nan_to_num(data['goCue_times'] - data['goCueTrigger_times'], nan=np.inf) @@ -930,7 +933,8 @@ def check_errorCue_delays(data, audio_output='harp', **_): Notes ----- - For non-harp soundcards the permissible delay is 0.062s + For non-harp sound card the permissible delay is 0.062s. This was chosen by taking the 99.5th + percentile of delays over 500 training sessions using the Xonar soundcard. """ threshold = 0.0015 if audio_output.lower() == 'harp' else 0.062 metric = np.nan_to_num(data['errorCue_times'] - data['errorCueTrigger_times'], nan=np.inf) diff --git a/ibllib/tests/qc/test_task_metrics.py b/ibllib/tests/qc/test_task_metrics.py index a2b64f5ea..404876160 100644 --- a/ibllib/tests/qc/test_task_metrics.py +++ b/ibllib/tests/qc/test_task_metrics.py @@ -527,7 +527,8 @@ def setUp(self): eid = '8dd0fcb0-1151-4c97-ae35-2e2421695ad7' one = ONE(**TEST_DB) self.qc = qcmetrics.HabituationQC(eid, one=one) - self.qc.extractor = Bunch({'data': self.load_fake_bpod_data()}) # Dummy extractor obj + # Dummy extractor obj + self.qc.extractor = Bunch({'data': self.load_fake_bpod_data(), 'settings': {}}) @staticmethod def load_fake_bpod_data(n=5): @@ -578,5 +579,5 @@ def test_compute(self): self.assertEqual(outcomes['_task_habituation_time'], 'NOT_SET') -if __name__ == "__main__": +if __name__ == '__main__': unittest.main(exit=False, verbosity=2)