pynwb.behavior module

class pynwb.behavior.SpatialSeries(name, data, reference_frame, unit='meters', conversion=1.0, resolution=-1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)[source]

Bases: 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 TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 1D or 2D. The first dimension must be time. If 2D, there can be 1, 2, or 3 columns, which represent x, y, and z.

  • reference_frame (str) – description defining what the zero-position is

  • unit (str) – The base unit of measurement (should be SI unit)

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

property reference_frame

description defining what the zero-position is

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

Bases: MultiContainerInterface

TimeSeries for storing behavioral 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 of 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
__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 one or multiple IntervalSeries objects to this BehavioralEpochs

Parameters

interval_series (list or tuple or dict or IntervalSeries) – one or multiple IntervalSeries objects to add to this BehavioralEpochs

create_interval_series(name, data=[], timestamps=None, comments='no comments', description='no description', control=None, control_description=None)

Create an IntervalSeries object and add it to this BehavioralEpochs

Parameters
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

property interval_series

a dictionary containing the IntervalSeries in this BehavioralEpochs

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

Bases: MultiContainerInterface

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

Parameters
  • 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 one or multiple TimeSeries objects to this BehavioralEvents

Parameters

time_series (list or tuple or dict or TimeSeries) – one or multiple TimeSeries objects to add to this BehavioralEvents

create_timeseries(name, data, unit, resolution=-1.0, conversion=1.0, offset=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, continuity=None)

Create a TimeSeries object and add it to this BehavioralEvents

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time. Can also store binary data, e.g., image frames

  • unit (str) – The base unit of measurement (should be SI unit)

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • continuity (str) – Optionally describe the continuity of the data. Can be “continuous”, “instantaneous”, or”step”. For example, a voltage trace would be “continuous”, because samples are recorded from a continuous process. An array of lick times would be “instantaneous”, because the data represents distinct moments in time. Times of image presentations would be “step” because the picture remains the same until the next time-point. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.

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'
property time_series

a dictionary containing the TimeSeries in this BehavioralEvents

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

Bases: MultiContainerInterface

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

Parameters
  • 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 one or multiple TimeSeries objects to this BehavioralTimeSeries

Parameters

time_series (list or tuple or dict or TimeSeries) – one or multiple TimeSeries objects to add to this BehavioralTimeSeries

create_timeseries(name, data, unit, resolution=-1.0, conversion=1.0, offset=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, continuity=None)

Create a TimeSeries object and add it to this BehavioralTimeSeries

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time. Can also store binary data, e.g., image frames

  • unit (str) – The base unit of measurement (should be SI unit)

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • continuity (str) – Optionally describe the continuity of the data. Can be “continuous”, “instantaneous”, or”step”. For example, a voltage trace would be “continuous”, because samples are recorded from a continuous process. An array of lick times would be “instantaneous”, because the data represents distinct moments in time. Times of image presentations would be “step” because the picture remains the same until the next time-point. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.

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'
property time_series

a dictionary containing the TimeSeries in this BehavioralTimeSeries

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

Bases: MultiContainerInterface

Eye-tracking data, representing pupil size.

Parameters
  • 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 one or multiple TimeSeries objects to this PupilTracking

Parameters

time_series (list or tuple or dict or TimeSeries) – one or multiple TimeSeries objects to add to this PupilTracking

create_timeseries(name, data, unit, resolution=-1.0, conversion=1.0, offset=0.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, continuity=None)

Create a TimeSeries object and add it to this PupilTracking

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time. Can also store binary data, e.g., image frames

  • unit (str) – The base unit of measurement (should be SI unit)

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • continuity (str) – Optionally describe the continuity of the data. Can be “continuous”, “instantaneous”, or”step”. For example, a voltage trace would be “continuous”, because samples are recorded from a continuous process. An array of lick times would be “instantaneous”, because the data represents distinct moments in time. Times of image presentations would be “step” because the picture remains the same until the next time-point. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.

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'
property time_series

a dictionary containing the TimeSeries in this PupilTracking

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

Bases: MultiContainerInterface

Eye-tracking data, representing direction of gaze.

Parameters
__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 one or multiple SpatialSeries objects to this EyeTracking

Parameters

spatial_series (list or tuple or dict or SpatialSeries) – one or multiple SpatialSeries objects to add to this EyeTracking

create_spatial_series(name, data, reference_frame, unit='meters', conversion=1.0, resolution=-1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)

Create a SpatialSeries object and add it to this EyeTracking

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 1D or 2D. The first dimension must be time. If 2D, there can be 1, 2, or 3 columns, which represent x, y, and z.

  • reference_frame (str) – description defining what the zero-position is

  • unit (str) – The base unit of measurement (should be SI unit)

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

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'
property spatial_series

a dictionary containing the SpatialSeries in this EyeTracking

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

Bases: 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
__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 one or multiple SpatialSeries objects to this CompassDirection

Parameters

spatial_series (list or tuple or dict or SpatialSeries) – one or multiple SpatialSeries objects to add to this CompassDirection

create_spatial_series(name, data, reference_frame, unit='meters', conversion=1.0, resolution=-1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)

Create a SpatialSeries object and add it to this CompassDirection

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 1D or 2D. The first dimension must be time. If 2D, there can be 1, 2, or 3 columns, which represent x, y, and z.

  • reference_frame (str) – description defining what the zero-position is

  • unit (str) – The base unit of measurement (should be SI unit)

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

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'
property spatial_series

a dictionary containing the SpatialSeries in this CompassDirection

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

Bases: MultiContainerInterface

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

Parameters
__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 one or multiple SpatialSeries objects to this Position

Parameters

spatial_series (list or tuple or dict or SpatialSeries) – one or multiple SpatialSeries objects to add to this Position

create_spatial_series(name, data, reference_frame, unit='meters', conversion=1.0, resolution=-1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)

Create a SpatialSeries object and add it to this Position

Parameters
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 1D or 2D. The first dimension must be time. If 2D, there can be 1, 2, or 3 columns, which represent x, y, and z.

  • reference_frame (str) – description defining what the zero-position is

  • unit (str) – The base unit of measurement (should be SI unit)

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO 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

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

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'
property spatial_series

a dictionary containing the SpatialSeries in this Position