pynwb.behavior module

class pynwb.behavior.SpatialSeries(name, source, data, reference_frame, conversion=1.0, resolution=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', parent=None, control=None, control_description=None)

Bases: pynwb.base.TimeSeries

Direction, e.g., of gaze or travel, or position. The TimeSeries::data field is a 2D array storing position or direction relative to some reference frame. Array structure: [num measurements] [num dimensions]. Each SpatialSeries has a text dataset reference_frame that indicates the zero-position, or the zero-axes for direction. For example, if representing gaze direction, “straight-ahead” might be a specific pixel on the monitor, or some other point in space. For position data, the 0,0 point might be the top-left corner of an enclosure, as viewed from the tracking camera. The unit of data will indicate how to interpret SpatialSeries values.

Create a SpatialSeries TimeSeries dataset

Parameters:
  • name (str) – The name of this SpatialSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • reference_frame (str) – description defining what the zero-position is
  • conversion (float) – Scalar to multiply each element by to conver to meters
  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • parent (NWBContainer) – The parent NWBContainer for this NWBContainer
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
reference_frame

description defining what the zero-position is

namespace = 'core'
neurodata_type = 'SpatialSeries'
class pynwb.behavior.BehavioralEpochs(source, interval_series={}, name='BehavioralEpochs')

Bases: pynwb.core.MultiContainerInterface

TimeSeries for storing behavoioral epochs. The objective of this and the other two Behavioral interfaces (e.g. BehavioralEvents and BehavioralTimeSeries) is to provide generic hooks for software tools/scripts. This allows a tool/script to take the output one specific interface (e.g., UnitTimes) and plot that data relative to another data modality (e.g., behavioral events) without having to define all possible modalities in advance. Declaring one of these interfaces means that one or more TimeSeries of the specified type is published. These TimeSeries should reside in a group having the same name as the interface. For example, if a BehavioralTimeSeries interface is declared, the module will have one or more TimeSeries defined in the module sub-group “BehavioralTimeSeries”. BehavioralEpochs should use IntervalSeries. BehavioralEvents is used for irregular events. BehavioralTimeSeries is for continuous data.

Parameters:
  • source (str) – the source of the data
  • interval_series (list or tuple or dict or IntervalSeries) – IntervalSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get an IntervalSeries from this BehavioralEpochs

Parameters:name (str) – the name of the IntervalSeries
Returns:the IntervalSeries with the given name
Return type:IntervalSeries
add_interval_series(interval_series)

Add an IntervalSeries to this BehavioralEpochs

Parameters:interval_series (list or tuple or dict or IntervalSeries) – the IntervalSeries to add
create_interval_series(name, source, data=[], timestamps=[], comments='no comments', description='no description', control=None, control_description=None)

Create an IntervalSeries and add it to this BehavioralEpochs

Parameters:
  • name (str) – The name of this TimeSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – >0 if interval started, <0 if interval ended.
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the IntervalSeries object that was created

Return type:

IntervalSeries

get_interval_series(name=None)

Get an IntervalSeries from this BehavioralEpochs

Parameters:name (str) – the name of the IntervalSeries
Returns:the IntervalSeries with the given name
Return type:IntervalSeries
interval_series

a dictionary containing the IntervalSeries in this BehavioralEpochs container

namespace = 'core'
neurodata_type = 'BehavioralEpochs'
class pynwb.behavior.BehavioralEvents(source, time_series={}, name='BehavioralEvents')

Bases: pynwb.core.MultiContainerInterface

TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details.

Parameters:
  • source (str) – the source of the data
  • time_series (list or tuple or dict or TimeSeries) – TimeSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a TimeSeries from this BehavioralEvents

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
add_timeseries(time_series)

Add a TimeSeries to this BehavioralEvents

Parameters:time_series (list or tuple or dict or TimeSeries) – the TimeSeries to add
create_timeseries(name, source, data=None, unit=None, resolution=0.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a TimeSeries and add it to this BehavioralEvents

Parameters:
  • name (str) – The name of this TimeSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • unit (str) – The base unit of measurement (should be SI unit)
  • resolution (str or float) – The smallest meaningful difference (in specified unit) between values in data
  • conversion (str or float) – Scalar to multiply each element in data to convert it to the specified unit
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the TimeSeries object that was created

Return type:

TimeSeries

get_timeseries(name=None)

Get a TimeSeries from this BehavioralEvents

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
namespace = 'core'
neurodata_type = 'BehavioralEvents'
time_series

a dictionary containing the TimeSeries in this BehavioralEvents container

class pynwb.behavior.BehavioralTimeSeries(source, time_series={}, name='BehavioralTimeSeries')

Bases: pynwb.core.MultiContainerInterface

TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details.

Parameters:
  • source (str) – the source of the data
  • time_series (list or tuple or dict or TimeSeries) – TimeSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a TimeSeries from this BehavioralTimeSeries

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
add_timeseries(time_series)

Add a TimeSeries to this BehavioralTimeSeries

Parameters:time_series (list or tuple or dict or TimeSeries) – the TimeSeries to add
create_timeseries(name, source, data=None, unit=None, resolution=0.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a TimeSeries and add it to this BehavioralTimeSeries

Parameters:
  • name (str) – The name of this TimeSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • unit (str) – The base unit of measurement (should be SI unit)
  • resolution (str or float) – The smallest meaningful difference (in specified unit) between values in data
  • conversion (str or float) – Scalar to multiply each element in data to convert it to the specified unit
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the TimeSeries object that was created

Return type:

TimeSeries

get_timeseries(name=None)

Get a TimeSeries from this BehavioralTimeSeries

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
namespace = 'core'
neurodata_type = 'BehavioralTimeSeries'
time_series

a dictionary containing the TimeSeries in this BehavioralTimeSeries container

class pynwb.behavior.PupilTracking(source, time_series={}, name='PupilTracking')

Bases: pynwb.core.MultiContainerInterface

Eye-tracking data, representing pupil size.

Parameters:
  • source (str) – the source of the data
  • time_series (list or tuple or dict or TimeSeries) – TimeSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a TimeSeries from this PupilTracking

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
add_timeseries(time_series)

Add a TimeSeries to this PupilTracking

Parameters:time_series (list or tuple or dict or TimeSeries) – the TimeSeries to add
create_timeseries(name, source, data=None, unit=None, resolution=0.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a TimeSeries and add it to this PupilTracking

Parameters:
  • name (str) – The name of this TimeSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • unit (str) – The base unit of measurement (should be SI unit)
  • resolution (str or float) – The smallest meaningful difference (in specified unit) between values in data
  • conversion (str or float) – Scalar to multiply each element in data to convert it to the specified unit
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the TimeSeries object that was created

Return type:

TimeSeries

get_timeseries(name=None)

Get a TimeSeries from this PupilTracking

Parameters:name (str) – the name of the TimeSeries
Returns:the TimeSeries with the given name
Return type:TimeSeries
namespace = 'core'
neurodata_type = 'PupilTracking'
time_series

a dictionary containing the TimeSeries in this PupilTracking container

class pynwb.behavior.EyeTracking(source, spatial_series={}, name='EyeTracking')

Bases: pynwb.core.MultiContainerInterface

Eye-tracking data, representing direction of gaze.

Parameters:
  • source (str) – the source of the data
  • spatial_series (list or tuple or dict or SpatialSeries) – SpatialSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a SpatialSeries from this EyeTracking

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
add_spatial_series(spatial_series)

Add a SpatialSeries to this EyeTracking

Parameters:spatial_series (list or tuple or dict or SpatialSeries) – the SpatialSeries to add
create_spatial_series(name, source, data, reference_frame, conversion=1.0, resolution=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a SpatialSeries and add it to this EyeTracking

Parameters:
  • name (str) – The name of this SpatialSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • reference_frame (str) – description defining what the zero-position is
  • conversion (float) – Scalar to multiply each element by to conver to meters
  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the SpatialSeries object that was created

Return type:

SpatialSeries

get_spatial_series(name=None)

Get a SpatialSeries from this EyeTracking

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
namespace = 'core'
neurodata_type = 'EyeTracking'
spatial_series

a dictionary containing the SpatialSeries in this EyeTracking container

class pynwb.behavior.CompassDirection(source, spatial_series={}, name='CompassDirection')

Bases: pynwb.core.MultiContainerInterface

With a CompassDirection interface, a module publishes a SpatialSeries object representing a floating point value for theta. The SpatialSeries::reference_frame field should indicate what direction corresponds to 0 and which is the direction of rotation (this should be clockwise). The si_unit for the SpatialSeries should be radians or degrees.

Parameters:
  • source (str) – the source of the data
  • spatial_series (list or tuple or dict or SpatialSeries) – SpatialSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a SpatialSeries from this CompassDirection

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
add_spatial_series(spatial_series)

Add a SpatialSeries to this CompassDirection

Parameters:spatial_series (list or tuple or dict or SpatialSeries) – the SpatialSeries to add
create_spatial_series(name, source, data, reference_frame, conversion=1.0, resolution=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a SpatialSeries and add it to this CompassDirection

Parameters:
  • name (str) – The name of this SpatialSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • reference_frame (str) – description defining what the zero-position is
  • conversion (float) – Scalar to multiply each element by to conver to meters
  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the SpatialSeries object that was created

Return type:

SpatialSeries

get_spatial_series(name=None)

Get a SpatialSeries from this CompassDirection

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
namespace = 'core'
neurodata_type = 'CompassDirection'
spatial_series

a dictionary containing the SpatialSeries in this CompassDirection container

class pynwb.behavior.Position(source, spatial_series={}, name='Position')

Bases: pynwb.core.MultiContainerInterface

Position data, whether along the x, x/y or x/y/z axis.

Parameters:
  • source (str) – the source of the data
  • spatial_series (list or tuple or dict or SpatialSeries) – SpatialSeries to store in this interface
  • name (str) – the name of this container
__getitem__(name=None)

Get a SpatialSeries from this Position

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
add_spatial_series(spatial_series)

Add a SpatialSeries to this Position

Parameters:spatial_series (list or tuple or dict or SpatialSeries) – the SpatialSeries to add
create_spatial_series(name, source, data, reference_frame, conversion=1.0, resolution=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)

Create a SpatialSeries and add it to this Position

Parameters:
  • name (str) – The name of this SpatialSeries dataset
  • source (str) – Name of TimeSeries or Modules that serve as the source for the data contained here. It can also be the name of a device, for stimulus or acquisition data
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – The data this TimeSeries dataset stores. Can also store binary data e.g. image frames
  • reference_frame (str) – description defining what the zero-position is
  • conversion (float) – Scalar to multiply each element by to conver to meters
  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data
  • timestamps (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or TimeSeries) – Timestamps for samples stored in data
  • starting_time (float) – The timestamp of the first sample
  • rate (float) – Sampling rate in Hz
  • comments (str) – Human-readable comments about this TimeSeries dataset
  • description (str) – Description of this TimeSeries dataset
  • control (Iterable) – Numerical labels that apply to each element in data
  • control_description (Iterable) – Description of each control value
Returns:

the SpatialSeries object that was created

Return type:

SpatialSeries

get_spatial_series(name=None)

Get a SpatialSeries from this Position

Parameters:name (str) – the name of the SpatialSeries
Returns:the SpatialSeries with the given name
Return type:SpatialSeries
namespace = 'core'
neurodata_type = 'Position'
spatial_series

a dictionary containing the SpatialSeries in this Position container