Skip to content

Commit f65a4ab

Browse files
authored
Merge pull request #12 from int-brain-lab/cuedBiasedQC
Fix cuedBiasedChoiceWorld QC and task extractor bug
2 parents 3663acf + 995edcb commit f65a4ab

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

iblrig_custom_tasks/samuel_cuedBiasedChoiceWorld/task.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ class Session(BiasedChoiceWorldSession):
1717

1818
protocol_name = 'samuel_cuedBiasedChoiceWorld'
1919

20-
def __init__(self, *args, delay_secs=0, **kwargs): #SP _init_ should be the same as biasedChoiceWorld, so should it be specified?
20+
def __init__(self, *args, delay_secs=0, **kwargs):
2121
super().__init__(**kwargs)
2222

2323
# loads in the settings in order to determine the main sync and thus the pipeline extractor tasks
2424
is_main_sync = self.hardware_settings.get('MAIN_SYNC', False)
2525
trials_task = 'CuedBiasedTrials' if is_main_sync else 'CuedBiasedTrialsTimeline'
2626
self.extractor_tasks = ['TrialRegisterRaw', trials_task, 'TrainingStatus']
27+
# Update experiment description which was created by superclass init
28+
next(iter(self.experiment_description['tasks']))['extractors'] = self.extractor_tasks
2729

28-
self.task_params["SESSION_DELAY_START"] = delay_secs
30+
self.task_params['SESSION_DELAY_START'] = delay_secs
2931
# init behaviour data
3032
self.movement_left = self.device_rotary_encoder.THRESHOLD_EVENTS[
3133
self.task_params.QUIESCENCE_THRESHOLDS[0]]

projects/samuel_cuedBiasedChoiceWorld.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Task QC for samuel_cuedBiasedChoiceWorld.
22
33
The task itself is identical to the biasedChoiceWorld except that there is an interactive delay
4-
between stimOn and goCue.
4+
between stimOn and goCue. Critically, the tone plays **before** the visual stimulus onset and is
5+
therefore not strictly a 'go cue' tone and the delay is not strictly an 'interactive' one.
56
67
Mapping the correct Bpod trials extractor is done in `projects.task_extractor_map.json`. The trial
78
alignment to the DAQ remains unchanged. The
@@ -27,7 +28,9 @@ def check_stimOn_goCue_delays(self, data, audio_output='harp', **_):
2728
"""
2829
Verify time delay between audio cue and stimOn is ~equal to the INTERACTIVE_DELAY specified.
2930
30-
Metric: M = stimOn_times - goCue_times - interactive_delay
31+
The so-called goCue is expected to occur before the stimulus onset.
32+
33+
Metric: M = goCue_times - stimOn_times - interactive_delay
3134
Criteria: 0 < M < 0.010 s
3235
Units: seconds [s]
3336
@@ -55,7 +58,7 @@ def check_stimOn_goCue_delays(self, data, audio_output='harp', **_):
5558
# If either are NaN, the result will be Inf to ensure that it crosses the failure threshold.
5659
threshold = 0.01 if audio_output.lower() == 'harp' else 0.053
5760
delay = self.extractor.settings['INTERACTIVE_DELAY']
58-
metric = np.nan_to_num(data['goCue_times'] - data['stimOn_times'] - delay, nan=np.inf)
61+
metric = np.nan_to_num(data['stimOn_times'] - data['goCue_times'] - delay, nan=np.inf)
5962
passed = (metric < threshold) & (metric > 0)
6063
assert data['intervals'].shape[0] == len(metric) == len(passed)
6164
return metric, passed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "project_extraction"
7-
version = "0.2.5"
7+
version = "0.2.6"
88
description = "Custom extractors for satellite tasks"
99
dynamic = [ "readme" ]
1010
keywords = [ "IBL", "neuro-science" ]

0 commit comments

Comments
 (0)