pynwb.behavior module¶
-
class
pynwb.behavior.
SpatialSeries
(name, data, reference_frame, conversion=1.0, resolution=-1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None)[source]¶ 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 TimeSeries dataset - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
orTimeSeries
) – The data values. Can be 1D or 2D. The first dimension must be time. The optional second dimension represents different features, e.g., x, y position - reference_frame (
str
) – description defining what the zero-position is - conversion (
str
or float) – Scalar to multiply each element in data to convert it to the specified unit - resolution (
str
or float) – The smallest meaningful difference (in specified unit) between values in data - timestamps (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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
-
reference_frame
¶ description defining what the zero-position is
-
namespace
= 'core'¶
-
neurodata_type
= 'SpatialSeries'¶
- name (
-
class
pynwb.behavior.
BehavioralEpochs
(interval_series={}, name='BehavioralEpochs')[source]¶ 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: - interval_series (
list
ortuple
ordict
orIntervalSeries
) – 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 IntervalSeriesReturns: the IntervalSeries with the given name Return type: IntervalSeries
-
add_interval_series
(interval_series)¶ Add an IntervalSeries to this BehavioralEpochs
Parameters: interval_series ( list
ortuple
ordict
orIntervalSeries
) – the IntervalSeries to add
-
create_interval_series
(name, data=[], timestamps=None, 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 - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
orTimeSeries
) – The data values. Must be 1D, where the first dimension must be time. Values are >0 if interval started, <0 if interval ended. - timestamps (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_interval_series
(name=None)¶ Get an IntervalSeries from this BehavioralEpochs
Parameters: name ( str
) – the name of the IntervalSeriesReturns: the IntervalSeries with the given name Return type: IntervalSeries
-
interval_series
¶ a dictionary containing the IntervalSeries in this BehavioralEpochs
-
namespace
= 'core'¶
-
neurodata_type
= 'BehavioralEpochs'¶
- interval_series (
-
class
pynwb.behavior.
BehavioralEvents
(time_series={}, name='BehavioralEvents')[source]¶ Bases:
pynwb.core.MultiContainerInterface
TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details.
Parameters: - time_series (
list
ortuple
ordict
orTimeSeries
) – 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 TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
add_timeseries
(time_series)¶ Add a TimeSeries to this BehavioralEvents
Parameters: time_series ( list
ortuple
ordict
orTimeSeries
) – the TimeSeries to add
-
create_timeseries
(name, data=None, unit=None, resolution=-1.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 - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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 (
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
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_timeseries
(name=None)¶ Get a TimeSeries from this BehavioralEvents
Parameters: name ( str
) – the name of the TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'BehavioralEvents'¶
-
time_series
¶ a dictionary containing the TimeSeries in this BehavioralEvents
- time_series (
-
class
pynwb.behavior.
BehavioralTimeSeries
(time_series={}, name='BehavioralTimeSeries')[source]¶ Bases:
pynwb.core.MultiContainerInterface
TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details.
Parameters: - time_series (
list
ortuple
ordict
orTimeSeries
) – 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 TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
add_timeseries
(time_series)¶ Add a TimeSeries to this BehavioralTimeSeries
Parameters: time_series ( list
ortuple
ordict
orTimeSeries
) – the TimeSeries to add
-
create_timeseries
(name, data=None, unit=None, resolution=-1.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 - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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 (
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
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_timeseries
(name=None)¶ Get a TimeSeries from this BehavioralTimeSeries
Parameters: name ( str
) – the name of the TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'BehavioralTimeSeries'¶
-
time_series
¶ a dictionary containing the TimeSeries in this BehavioralTimeSeries
- time_series (
-
class
pynwb.behavior.
PupilTracking
(time_series={}, name='PupilTracking')[source]¶ Bases:
pynwb.core.MultiContainerInterface
Eye-tracking data, representing pupil size.
Parameters: - time_series (
list
ortuple
ordict
orTimeSeries
) – 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 TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
add_timeseries
(time_series)¶ Add a TimeSeries to this PupilTracking
Parameters: time_series ( list
ortuple
ordict
orTimeSeries
) – the TimeSeries to add
-
create_timeseries
(name, data=None, unit=None, resolution=-1.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 - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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 (
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
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_timeseries
(name=None)¶ Get a TimeSeries from this PupilTracking
Parameters: name ( str
) – the name of the TimeSeriesReturns: the TimeSeries with the given name Return type: TimeSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'PupilTracking'¶
-
time_series
¶ a dictionary containing the TimeSeries in this PupilTracking
- time_series (
-
class
pynwb.behavior.
EyeTracking
(spatial_series={}, name='EyeTracking')[source]¶ Bases:
pynwb.core.MultiContainerInterface
Eye-tracking data, representing direction of gaze.
Parameters: - spatial_series (
list
ortuple
ordict
orSpatialSeries
) – 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 SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
add_spatial_series
(spatial_series)¶ Add a SpatialSeries to this EyeTracking
Parameters: spatial_series ( list
ortuple
ordict
orSpatialSeries
) – the SpatialSeries to add
-
create_spatial_series
(name, data, reference_frame, conversion=1.0, resolution=-1.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 TimeSeries dataset - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
orTimeSeries
) – The data values. Can be 1D or 2D. The first dimension must be time. The optional second dimension represents different features, e.g., x, y position - reference_frame (
str
) – description defining what the zero-position is - conversion (
str
or float) – Scalar to multiply each element in data to convert it to the specified unit - resolution (
str
or float) – The smallest meaningful difference (in specified unit) between values in data - timestamps (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_spatial_series
(name=None)¶ Get a SpatialSeries from this EyeTracking
Parameters: name ( str
) – the name of the SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'EyeTracking'¶
-
spatial_series
¶ a dictionary containing the SpatialSeries in this EyeTracking
- spatial_series (
-
class
pynwb.behavior.
CompassDirection
(spatial_series={}, name='CompassDirection')[source]¶ 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: - spatial_series (
list
ortuple
ordict
orSpatialSeries
) – 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 SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
add_spatial_series
(spatial_series)¶ Add a SpatialSeries to this CompassDirection
Parameters: spatial_series ( list
ortuple
ordict
orSpatialSeries
) – the SpatialSeries to add
-
create_spatial_series
(name, data, reference_frame, conversion=1.0, resolution=-1.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 TimeSeries dataset - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
orTimeSeries
) – The data values. Can be 1D or 2D. The first dimension must be time. The optional second dimension represents different features, e.g., x, y position - reference_frame (
str
) – description defining what the zero-position is - conversion (
str
or float) – Scalar to multiply each element in data to convert it to the specified unit - resolution (
str
or float) – The smallest meaningful difference (in specified unit) between values in data - timestamps (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_spatial_series
(name=None)¶ Get a SpatialSeries from this CompassDirection
Parameters: name ( str
) – the name of the SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'CompassDirection'¶
-
spatial_series
¶ a dictionary containing the SpatialSeries in this CompassDirection
- spatial_series (
-
class
pynwb.behavior.
Position
(spatial_series={}, name='Position')[source]¶ Bases:
pynwb.core.MultiContainerInterface
Position data, whether along the x, x/y or x/y/z axis.
Parameters: - spatial_series (
list
ortuple
ordict
orSpatialSeries
) – 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 SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
add_spatial_series
(spatial_series)¶ Add a SpatialSeries to this Position
Parameters: spatial_series ( list
ortuple
ordict
orSpatialSeries
) – the SpatialSeries to add
-
create_spatial_series
(name, data, reference_frame, conversion=1.0, resolution=-1.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 TimeSeries dataset - data (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
orTimeSeries
) – The data values. Can be 1D or 2D. The first dimension must be time. The optional second dimension represents different features, e.g., x, y position - reference_frame (
str
) – description defining what the zero-position is - conversion (
str
or float) – Scalar to multiply each element in data to convert it to the specified unit - resolution (
str
or float) – The smallest meaningful difference (in specified unit) between values in data - timestamps (
ndarray
orlist
ortuple
orDataset
orHDMFDataset
orAbstractDataChunkIterator
orDataIO
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: - name (
-
get_spatial_series
(name=None)¶ Get a SpatialSeries from this Position
Parameters: name ( str
) – the name of the SpatialSeriesReturns: the SpatialSeries with the given name Return type: SpatialSeries
-
namespace
= 'core'¶
-
neurodata_type
= 'Position'¶
-
spatial_series
¶ a dictionary containing the SpatialSeries in this Position
- spatial_series (