ibllib.pipes.dynamic_pipeline

Task pipeline creation from an acquisition description.

The principal function here is make_pipeline which reads an _ibl_experiment.description.yaml file and determines the set of tasks required to preprocess the session.

In the experiment description file there is a ‘tasks’ key that defines each task protocol and the location of the raw data (i.e. task collection). The protocol subkey may contain an ‘extractors’ field that should contain a list of dynamic pipeline task class names for extracting the task data. These must be subclasses of the ibllib.pipes.base_tasks.DynamicTask class. If the extractors key is absent or empty, the tasks are chosen based on the sync label and protocol name.

NB: The standard behvaiour extraction task classes (e.g. ibllib.pipes.behaviour_tasks.ChoiceWorldTrialsBpod and ibllib.pipes.behaviour_tasks.ChoiceWorldTrialsNidq) handle the clock synchronization, behaviour plots and QC. This is typically independent of the Bpod trials extraction (i.e. extraction of trials data from the Bpod raw data, in Bpod time). The Bpod trials extractor class is determined by the ibllib.io.extractors.base.protocol2extractor() map. IBL protocols may be added to the ibllib.io.extractors.task_extractor_map.json file, while non-IBL ones should be in projects.base.task_extractor_map.json file located in the personal projects repo. The Bpod trials extractor class must be a subclass of the ibllib.io.extractors.base.BaseBpodTrialsExtractor class, and located in either the personal projects repo or in ibllib.io.extractors.bpod_trials module.

Functions

acquisition_description_legacy_session

From a legacy session create a dictionary corresponding to the acquisition description.

get_acquisition_description

get_trials_tasks

Return a list of pipeline trials extractor task objects for a given session.

is_active_trials_task

Check if task is for active choice world extraction.

load_pipeline_dict

make_pipeline

Creates a pipeline of extractor tasks from a session's experiment description file.

make_pipeline_dict

acquisition_description_legacy_session(session_path, save=False)[source]

From a legacy session create a dictionary corresponding to the acquisition description.

Parameters:
  • session_path (str, pathlib.Path) – A path to a session to describe.

  • save (bool) – If true, saves the acquisition description file to _ibl_experiment.description.yaml.

Returns:

The legacy acquisition description.

Return type:

dict

get_acquisition_description(protocol)[source]

” This is a set of example acquisition descriptions for experiments - choice_world_recording - choice_world_biased - choice_world_training - choice_world_habituation - choice_world_passive That are part of the IBL pipeline

get_trials_tasks(session_path, one=None, bpod_only=False)[source]

Return a list of pipeline trials extractor task objects for a given session.

This function supports both legacy and dynamic pipeline sessions. Dynamic tasks are returned for both recent and legacy sessions. Only Trials tasks are returned, not the training status or raw registration tasks.

Parameters:
  • session_path (str, pathlib.Path) – An absolute path to a session.

  • one (one.api.One) – An ONE instance.

  • bpod_only (bool) – If true, extract trials from Bpod clock instead of the main DAQ’s.

Returns:

A list of task objects for the provided session.

Return type:

list of pipes.tasks.Task

Examples

Return the tasks for active choice world extraction

>>> tasks = list(filter(is_active_trials_task, get_trials_tasks(session_path)))
is_active_trials_task(task) bool[source]

Check if task is for active choice world extraction.

Parameters:

task (ibllib.pipes.tasks.Task) – A task instance to test.

Returns:

True if the task name starts with ‘Trials_’ and outputs a trials.table dataset.

Return type:

bool

make_pipeline(session_path, **pkwargs)[source]

Creates a pipeline of extractor tasks from a session’s experiment description file.

Parameters:
  • session_path (str, Path) – The absolute session path, i.e. ‘/path/to/subject/yyyy-mm-dd/nnn’.

  • pkwargs – Optional arguments passed to the ibllib.pipes.tasks.Pipeline constructor.

Returns:

A task pipeline object.

Return type:

ibllib.pipes.tasks.Pipeline

make_pipeline_dict(pipeline, save=True)[source]
load_pipeline_dict(path)[source]