-
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.
Merge pull request #7 from int-brain-lab/neuromodulatorsExtraction
Several fixes
- Loading branch information
Showing
10 changed files
with
39 additions
and
51 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 was deleted.
Oops, something went wrong.
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
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,10 +1,9 @@ | ||
""" | ||
Custom behaviour extractor tasks for personal projects. | ||
The task class name(s) should be added to the | ||
The task class name(s) should be added to the imports | ||
NB: This may need changing in the future if one of these modules requires optional dependencies. | ||
""" | ||
from projects.neuromodulators import ChoiceWorldNeuromodulators | ||
from projects.samuel_cuedBiasedChoiceWorld import CuedBiasedTrials, CuedBiasedTrialsTimeline | ||
from projects.nate_optoBiasedChoiceWorld import OptoTrialsNidq, OptoTrialsBpod |
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,23 +1,24 @@ | ||
import numpy as np | ||
from ibllib.io.extractors.biased_trials import BiasedTrials | ||
from ibllib.pipes.behavior_tasks import ChoiceWorldTrialsBpod | ||
from ibllib.io.extractors.base import BaseBpodTrialsExtractor, run_extractor_classes | ||
|
||
|
||
class ChoiceWorldNeuromodulators(ChoiceWorldTrialsBpod): | ||
def _run(self, update=True): | ||
""" | ||
Extracts an iblrig training session | ||
""" | ||
save_path = self.session_path.joinpath(self.output_collection) | ||
extractor = TrialsTableNeuromodulator(session_path=self.session_path, task_collection=self.task_collection, save_path=save_path) | ||
out, fil = extractor.extract() | ||
return fil | ||
class TrialsTableNeuromodulator(BaseBpodTrialsExtractor): | ||
"""Extract neuromodulator task events. | ||
Include a couple custom trial variables in `var_names` property. | ||
class TrialsTableNeuromodulator(BiasedTrials): | ||
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
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,4 +1,5 @@ | ||
{ | ||
"samuel_cuedBiasedChoiceWorld": "BiasedTrials", | ||
"_iblrig_tasks_neuromodulatorChoiceWorld": "projects.neuromodulators.TrialsTableNeuromodulator", | ||
"nate_optoBiasedChoiceWorld": "projects.nate_optoBiasedChoiceWorld.TrialsOpto" | ||
} |
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