-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import numpy as np | ||
from ibllib.io.extractors.biased_trials import BiasedTrials | ||
from ibllib.io.extractors.base import BaseBpodTrialsExtractor, run_extractor_classes | ||
|
||
|
||
class TrialsTableNeuromodulator(BiasedTrials): | ||
def __init__(self, *args, **kwargs): | ||
"""Include custom trial variables in `var_names` property. | ||
class TrialsTableNeuromodulator(BaseBpodTrialsExtractor): | ||
"""Extract neuromodulator task events. | ||
NB: In order to save to file and register these variables, we would need a custom ibllib.pipes.tasks.Task with | ||
the correct output file names. | ||
""" | ||
super().__init__(*args, **kwargs) | ||
self.save_names = BiasedTrials.save_names + (None, None) | ||
self.var_names = BiasedTrials.var_names + ('omit_feedback', 'exit_state') | ||
Include a couple custom trial variables in `var_names` property. | ||
NB: In order to save to file and register these variables, we would need a custom ibllib.pipes.tasks.Task with | ||
the correct output file names. | ||
""" | ||
save_names = BiasedTrials.save_names + (None, None) | ||
var_names = BiasedTrials.var_names + ('omit_feedback', 'exit_state') | ||
|
||
def _extract(self, *args, **kwargs): | ||
out = super(TrialsTableNeuromodulator, self)._extract(*args, **kwargs) | ||
# Extract common biased choice world datasets | ||
out, _ = run_extractor_classes( | ||
[BiasedTrials], session_path=self.session_path, bpod_trials=self.bpod_trials, | ||
settings=self.settings, save=False, task_collection=self.task_collection) | ||
out[0]['omit_feedback'] = np.array([t['omit_feedback'] for t in self.bpod_trials]) | ||
out[0]['exit_state'] = np.array([t['behavior_data']['States timestamps']['exit_state'][0][0] for t in self.bpod_trials]) | ||
return out | ||
return {k: out[k] for k in self.var_names} # Ensures all datasets present and ordered |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters