ibllib.io.extractors.bpod_trials

Trials data extraction from raw Bpod output.

This module will extract the Bpod trials and wheel data based on the task protocol, i.e. habituation, training or biased.

Functions

extract_all

Extracts a training session from its path.

get_bpod_extractor

Returns an extractor for a given session.

extract_all(session_path, save=True, bpod_trials=None, settings=None, task_collection='raw_behavior_data', extractor_type=None, save_path=None)[source]

Extracts a training session from its path. NB: Wheel must be extracted first in order to extract trials.firstMovement_times.

Parameters:
  • session_path (str, pathlib.Path) – The path to the session to be extracted.

  • task_collection (str) – The subfolder containing the raw Bpod data files.

  • save (bool) – If true, save the output files to save_path.

  • bpod_trials (list of dict) – The loaded Bpod trial data. If None, attempts to load _iblrig_taskData.raw from raw_task_collection.

  • settings (dict) – The loaded Bpod settings. If None, attempts to load _iblrig_taskSettings.raw from raw_task_collection.

  • extractor_type (str) – The type of extraction. Supported types are {‘ephys’, ‘biased’, ‘biased_opto’, ‘ephys_biased_opto’, ‘training’, ‘ephys_training’, ‘habituation’}. If None, extractor type determined from settings.

  • save_path (str, pathlib.Path) – The location of the output files if save is true. Defaults to <session_path>/alf.

Returns:

  • dict – The extracted trials data.

  • dict – The extracted wheel data.

  • list of pathlib.Path – The output files if save is true.

get_bpod_extractor(session_path, protocol=None, task_collection='raw_behavior_data') BaseBpodTrialsExtractor[source]

Returns an extractor for a given session.

Parameters:
  • session_path (str, pathlib.Path) – The path to the session to be extracted.

  • protocol (str, optional) – The protocol name, otherwise uses the PYBPOD_PROTOCOL key in iblrig task settings files.

  • task_collection (str) – The folder within the session that contains the raw task data.

Returns:

An instance of the task extractor class, instantiated with the session path.

Return type:

BaseBpodTrialsExtractor