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_pipeline

Get the pre-processinf pipeline name from a session path

get_session_extractor_type

From a session path, loads the settings file, finds the task and checks if extractors exist task names examples:

get_task_extractor_type

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_task_protocol

run_extractor_classes

Run a set of extractors with the same inputs

Classes

BaseBpodTrialsExtractor

Base (abstract) extractor class for bpod jsonable data set Wrps the _extract private method

BaseExtractor

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
default_path = PosixPath('alf')
session_path = None
extract(save=False, path_out=None, **kwargs)[source]
Returns

numpy.ndarray or list of ndarrays, list of filenames

Return type

dtype(‘float64’)

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
extract(task_collection='raw_behavior_data', 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_protocol(session_path)[source]
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)[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)[source]

Get the pre-processinf pipeline name from a session path

Parameters

session_path

Returns