ibllib.io.extractors.base
Base Extractor classes. A module for the base Extractor classes. The Extractor, given a session path, will extract the processed data from raw hardware files and optionally save them.
Functions
Get the Bpod trials extractor class associated with a given Bpod session. |
|
Get the pre-processing pipeline name from a session path |
|
From a session path, loads the settings file, finds the task and checks if extractors exist task names examples: |
|
Returns the task type string from the full pybpod task name: _iblrig_tasks_biasedChoiceWorld3.7.0 returns "biased" _iblrig_tasks_trainingChoiceWorld3.6.0 returns "training' |
|
Get the Bpod trials extractor class associated with a given Bpod task protocol. |
|
Run a set of extractors with the same inputs |
Classes
Base (abstract) extractor class for bpod jsonable data set Wrps the _extract private method |
|
Base extractor class Writing an extractor checklist: - on the child class, overload the _extract method - this method should output one or several numpy.arrays or dataframe with a consistent shape - save_names is a list or a string of filenames, there should be one per dataset - set save_names to None for a dataset that doesn't need saving (could be set dynamically in the _extract method) |
- class BaseExtractor(session_path=None)[source]
Bases:
ABC
Base extractor class Writing an extractor checklist: - on the child class, overload the _extract method - this method should output one or several numpy.arrays or dataframe with a consistent shape - save_names is a list or a string of filenames, there should be one per dataset - set save_names to None for a dataset that doesn’t need saving (could be set dynamically in the _extract method)
- Parameters:
session_path (str/Path) – Absolute path of session folder
- save_names = None
- var_names = None
- default_path = PosixPath('alf')
- session_path = None
- class BaseBpodTrialsExtractor(session_path=None)[source]
Bases:
BaseExtractor
Base (abstract) extractor class for bpod jsonable data set Wrps the _extract private method
- Parameters:
session_path (str) – Absolute path of session folder
:param bpod_trials :param settings
- bpod_trials = None
- settings = None
- task_collection = None
- extract(bpod_trials=None, settings=None, **kwargs)[source]
- Param:
bpod_trials (optional) bpod trials from jsonable in a dictionary
- Param:
settings (optional) bpod iblrig settings json file in a dictionary
- Param:
save (bool) write output ALF files, defaults to False
- Param:
path_out (pathlib.Path) output path (defaults to {session_path}/alf)
- Returns:
numpy.ndarray or list of ndarrays, list of filenames
- Return type:
dtype(‘float64’)
- run_extractor_classes(classes, session_path=None, **kwargs)[source]
Run a set of extractors with the same inputs
- Parameters:
classes – list of Extractor class
save – True/False
path_out – (defaults to alf path)
kwargs – extractor arguments (session_path…)
- Returns:
dictionary of arrays, list of files
- get_task_extractor_type(task_name)[source]
Returns the task type string from the full pybpod task name: _iblrig_tasks_biasedChoiceWorld3.7.0 returns “biased” _iblrig_tasks_trainingChoiceWorld3.6.0 returns “training’
- Parameters:
task_name –
- Returns:
one of [‘biased’, ‘habituation’, ‘training’, ‘ephys’, ‘mock_ephys’, ‘sync_ephys’]
- get_session_extractor_type(session_path, task_collection='raw_behavior_data')[source]
From a session path, loads the settings file, finds the task and checks if extractors exist task names examples:
- Parameters:
session_path –
- Returns:
bool
- get_pipeline(session_path, task_collection='raw_behavior_data')[source]
Get the pre-processing pipeline name from a session path
- Parameters:
session_path –
- Returns:
- get_bpod_extractor_class(session_path, task_collection='raw_behavior_data')[source]
Get the Bpod trials extractor class associated with a given Bpod session.
- Parameters:
session_path (str, pathlib.Path) – The session path containing Bpod behaviour data.
task_collection (str) – The session_path subfolder containing the Bpod settings file.
- Returns:
The extractor class name.
- Return type:
str
- protocol2extractor(protocol)[source]
Get the Bpod trials extractor class associated with a given Bpod task protocol.
The Bpod task protocol can be found in the ‘PYBPOD_PROTOCOL’ field of _iblrig_taskSettings.raw.json.
- Parameters:
protocol (str) – A Bpod task protocol name.
- Returns:
The extractor class name.
- Return type:
str