diff --git a/iblrig_custom_tasks/nate_optoBiasedChoiceWorld/task.py b/iblrig_custom_tasks/nate_optoBiasedChoiceWorld/task.py index 5c27bfc..a448a8e 100644 --- a/iblrig_custom_tasks/nate_optoBiasedChoiceWorld/task.py +++ b/iblrig_custom_tasks/nate_optoBiasedChoiceWorld/task.py @@ -110,7 +110,7 @@ def extra_parser(): default=DEFAULTS['OPTO_STIM_STATES'], nargs='+', type=str, - help=f'list of the state machine states where opto stim should be delivered', + help='list of the state machine states where opto stim should be delivered', ) return parser diff --git a/projects/nate_optoBiasedChoiceWorld.py b/projects/nate_optoBiasedChoiceWorld.py index 39b2b37..0d97e15 100644 --- a/projects/nate_optoBiasedChoiceWorld.py +++ b/projects/nate_optoBiasedChoiceWorld.py @@ -52,12 +52,13 @@ def _extract(self, extractor_classes=None, **kwargs) -> dict: settings=settings, save=False, task_collection=self.task_collection) # Extract laser dataset - out['laser_intervals'] = np.full((len(self.bpod_trials), 2), np.nan) - for i, trial in enumerate(self.bpod_trials): + laser_intervals = [] + for trial in filter(lambda t: t['opto_stimulation'], self.bpod_trials): states = trial['behavior_data']['States timestamps'] # Assumes one of these states per trial: takes the timestamp of the first matching state start = next((v[0][0] for k, v in states.items() if k in settings['OPTO_TTL_STATES']), np.nan) stop = next((v[0][0] for k, v in states.items() if k in settings['OPTO_STOP_STATES']), np.nan) - out['laser_intervals'][i, :] = (start, stop) + laser_intervals.append((start, stop)) + out['laser_intervals'] = np.array(laser_intervals, dtype=np.float64) return {k: out[k] for k in self.var_names} # Ensures all datasets present and ordered diff --git a/pyproject.toml b/pyproject.toml index f461ff4..5ff5c27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "project_extraction" -version = "0.2.0" +version = "0.2.1" description = "Custom extractors for satellite tasks" dynamic = [ "readme" ] keywords = [ "IBL", "neuro-science" ]