ibllib.io.extractors.training_trials

Functions

extract_all

Extract trials and wheel data.

Classes

Choice

Get the subject's choice in every trial.

ContrastLR

Get left and right contrasts from raw datafile.

ErrorCueTriggerTimes

FeedbackTimes

Get the times the water or error tone was delivered to the animal.

FeedbackType

Get the feedback that was delivered to subject.

GoCueTimes

Get trigger times of goCue from state machine.

GoCueTriggerTimes

Get trigger times of goCue from state machine.

IncludedTrials

Intervals

Trial start to trial end.

ItiDuration

Calculate duration of iti from state timestamps.

ItiInTimes

PhasePosQuiescence

Extracts stimulus phase, position and quiescence from Bpod data.

ProbabilityLeft

RepNum

Count the consecutive repeated trials.

ResponseTimes

Time (in absolute seconds from session start) when a response was recorded.

RewardVolume

Load reward volume delivered for each trial.

StimFreezeTriggerTimes

StimOffTriggerTimes

StimOnOffFreezeTimes

Extracts stim on / off and freeze times from Bpod BNC1 detected fronts

StimOnTimes_deprecated

StimOnTriggerTimes

TrainingTrials

TrialType

TrialsTable

Extracts the following into a table from Bpod raw data:

class TrainingTrials(session_path=None)[source]

Bases: BaseBpodTrialsExtractor

save_names = ('_ibl_trials.repNum.npy', '_ibl_trials.goCueTrigger_times.npy', '_ibl_trials.stimOnTrigger_times.npy', None, None, None, None, '_ibl_trials.table.pqt', None, None, '_ibl_wheel.timestamps.npy', '_ibl_wheel.position.npy', '_ibl_wheelMoves.intervals.npy', '_ibl_wheelMoves.peakAmplitude.npy', None, None, None, None, None)

The filenames of each extracted dataset, or None if array should not be saved.

Type:

tuple of str

var_names = ('repNum', 'goCueTrigger_times', 'stimOnTrigger_times', 'itiIn_times', 'stimOffTrigger_times', 'stimFreezeTrigger_times', 'errorCueTrigger_times', 'table', 'stimOff_times', 'stimFreeze_times', 'wheel_timestamps', 'wheel_position', 'wheelMoves_intervals', 'wheelMoves_peakAmplitude', 'peakVelocity_times', 'is_final_movement', 'phase', 'position', 'quiescence')

A list of names for the extracted variables. These become the returned output keys.

Type:

tuple of str

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

Extract trials and wheel data.

For task versions >= 5.0.0, outputs wheel data and trials.table dataset (+ some extra datasets)

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

  • save (bool) – If true save the data files to ALF

  • bpod_trials (list of dicts) – The Bpod trial dicts loaded from the _iblrig_taskData.raw dataset

  • settings (dict) – The Bpod settings loaded from the _iblrig_taskSettings.raw dataset

Return type:

A list of extracted data and a list of file paths if save is True (otherwise None)