ibllib.pipes.behavior_tasks

Standard task protocol extractor dynamic pipeline tasks.

Classes

ChoiceWorldTrialsBpod

ChoiceWorldTrialsNidq

ChoiceWorldTrialsTimeline

Behaviour task extractor with DAQdata.raw NPY datasets.

HabituationRegisterRaw

HabituationTrialsBpod

HabituationTrialsNidq

PassiveRegisterRaw

PassiveTask

PassiveTaskTimeline

TODO should be mesoscope invariant, using wiring file

TrainingStatus

TrialRegisterRaw

class HabituationRegisterRaw(session_path, **kwargs)[source]

Bases: RegisterRawDataTask, BehaviourTask

priority = 100
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class HabituationTrialsBpod(session_path, **kwargs)[source]

Bases: BehaviourTask

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

extract_behaviour(**kwargs)[source]

Extract trials data.

This is an abstract method called by _run and run_qc methods. Subclasses should return the extracted trials data and a list of output files. This method should also save the trials extractor object to the :prop:`extractor` property for use by run_qc.

Parameters:

save (bool) – Whether to save the extracted data as ALF datasets.

Returns:

  • dict – A dictionary of trials data.

  • list of pathlib.Path – A list of output file paths if save == true.

run_qc(trials_data=None, update=True)[source]

Run task QC.

Subclass method should return the QC object. This just validates the trials_data is not None.

Parameters:
  • trials_data (dict) – A dictionary of extracted trials data. The output of extract_behaviour().

  • update (bool) – If true, update Alyx with the QC outcome.

Returns:

A TaskQC object replete with task data and computed metrics.

Return type:

ibllib.qc.task_metrics.TaskQC

class HabituationTrialsNidq(session_path, **kwargs)[source]

Bases: HabituationTrialsBpod

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

extract_behaviour(save=True, **kwargs)[source]

Extract the habituationChoiceWorld trial data using NI DAQ clock.

run_qc(trials_data=None, update=True, **_)[source]

Run and update QC.

This adds the bpod TTLs to the QC object after the QC is run in the super call method. The raw Bpod TTLs are not used by the QC however they are used in the iblapps QC plot.

class TrialRegisterRaw(session_path, **kwargs)[source]

Bases: RegisterRawDataTask, BehaviourTask

priority = 100
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class PassiveRegisterRaw(session_path, **kwargs)[source]

Bases: RegisterRawDataTask, BehaviourTask

priority = 100
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class PassiveTask(session_path, **kwargs)[source]

Bases: BehaviourTask

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class PassiveTaskTimeline(session_path, **kwargs)[source]

Bases: BehaviourTask, MesoscopeTask

TODO should be mesoscope invariant, using wiring file

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class ChoiceWorldTrialsBpod(session_path, **kwargs)[source]

Bases: BehaviourTask

priority = 90
job_size = 'small'
extractor = None

An instance of the Bpod trials extractor.

Type:

ibllib.io.extractors.base.BaseBpodTrialsExtractor

property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

extract_behaviour(**kwargs)[source]

Extract trials data.

This is an abstract method called by _run and run_qc methods. Subclasses should return the extracted trials data and a list of output files. This method should also save the trials extractor object to the :prop:`extractor` property for use by run_qc.

Parameters:

save (bool) – Whether to save the extracted data as ALF datasets.

Returns:

  • dict – A dictionary of trials data.

  • list of pathlib.Path – A list of output file paths if save == true.

run_qc(trials_data=None, update=True, QC=None)[source]

Run the task QC.

Parameters:
  • trials_data (dict) – The complete extracted task data.

  • update (bool) – If True, updates the session QC fields on Alyx.

  • QC (ibllib.qc.task_metrics.TaskQC) – An optional QC class to instantiate.

Returns:

The task QC object.

Return type:

ibllib.qc.task_metrics.TaskQC

class ChoiceWorldTrialsNidq(session_path, **kwargs)[source]

Bases: ChoiceWorldTrialsBpod

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

extract_behaviour(save=True, **kwargs)[source]

Extract trials data.

This is an abstract method called by _run and run_qc methods. Subclasses should return the extracted trials data and a list of output files. This method should also save the trials extractor object to the :prop:`extractor` property for use by run_qc.

Parameters:

save (bool) – Whether to save the extracted data as ALF datasets.

Returns:

  • dict – A dictionary of trials data.

  • list of pathlib.Path – A list of output file paths if save == true.

run_qc(trials_data=None, update=False, plot_qc=False, QC=None)[source]

Run the task QC.

Parameters:
  • trials_data (dict) – The complete extracted task data.

  • update (bool) – If True, updates the session QC fields on Alyx.

  • QC (ibllib.qc.task_metrics.TaskQC) – An optional QC class to instantiate.

Returns:

The task QC object.

Return type:

ibllib.qc.task_metrics.TaskQC

class ChoiceWorldTrialsTimeline(session_path, **kwargs)[source]

Bases: ChoiceWorldTrialsNidq

Behaviour task extractor with DAQdata.raw NPY datasets.

property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

extract_behaviour(save=True, **kwargs)[source]

Extract the Bpod trials data and Timeline acquired signals.

class TrainingStatus(session_path, **kwargs)[source]

Bases: BehaviourTask

priority = 90
job_size = 'small'
property signature

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)