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

PassiveTaskNidq

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

Bases: BehaviourTask

priority = 90
job_size = 'small'
property signature

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

Bases: RegisterRawDataTask, BehaviourTask

priority = 100
job_size = 'small'
property signature

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

Bases: BehaviourTask

priority = 90
job_size = 'small'
property signature

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

Bases: BehaviourTask, MesoscopeTask

TODO should be mesoscope invariant, using wiring file

priority = 90
job_size = 'small'
property signature

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

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

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns: