Skip to content

Commit

Permalink
QC notes and test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Nov 6, 2023
1 parent e7ed533 commit 06d65ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions ibllib/qc/task_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions ibllib/tests/qc/test_task_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

0 comments on commit 06d65ea

Please sign in to comment.