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 (list or ndarray or Iterable) – 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 (list or ndarray or Iterable) – 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
class pynwb.behavior.BehavioralEpochs(source, interval_series, name='BehavioralEpochs')

Bases: pynwb.core.NWBContainer

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 represented in this container.
  • interval_series (list or IntervalSeries) – IntervalSeries or any subtype.
  • name (str) – The name of this BehavioralEpochs container
interval_series
class pynwb.behavior.BehavioralEvents(source, time_series, name='BehavioralEvents')

Bases: pynwb.core.NWBContainer

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

Parameters:
  • source (str) – the source of the data
  • time_series (TimeSeries) – TimeSeries or any subtype.
  • name (str) – The name of this BehavioralEvents container
time_series
class pynwb.behavior.BehavioralTimeSeries(source, time_series, name='BehavioralTimeSeries')

Bases: pynwb.core.NWBContainer

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

Parameters:
  • source (str) – the source of the data
  • time_series (TimeSeries) – <TimeSeries> or any subtype.
  • name (str) – The name of this BehavioralTimeSeries
time_series
class pynwb.behavior.PupilTracking(source, time_series, name='PupilTracking')

Bases: pynwb.core.NWBContainer

Eye-tracking data, representing pupil size.

Parameters:
  • source (str) – the source of the data
  • time_series (TimeSeries) –
  • name (str) – The name of this PupilTracking container
time_series
class pynwb.behavior.EyeTracking(source, spatial_series, name='EyeTracking')

Bases: pynwb.core.NWBContainer

Eye-tracking data, representing direction of gaze.

Parameters:
  • source (str) – the source of the data
  • spatial_series (list or SpatialSeries) –
  • name (str) – The name of this EyeTracking container
spatial_series
class pynwb.behavior.CompassDirection(source, spatial_series, name='CompassDirection')

Bases: pynwb.core.NWBContainer

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 SpatialSeries) – SpatialSeries or any subtype.
  • name (str) – The name of this CompassDirection container
spatial_series
class pynwb.behavior.Position(source, spatial_series, name='Position')

Bases: pynwb.core.NWBContainer

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 SpatialSeries) –
  • name (str) – The name of this Position container
spatial_series
class pynwb.behavior.CorrectedImageStack(source, corrected, original, xy_translation, name='CorrectedImageStack')

Bases: pynwb.core.NWBContainer

Parameters:
  • source (str) – the source of the data
  • corrected (ImageSeries) – Image stack with frames shifted to the common coordinates.
  • original (ImageSeries) – Link to image series that is being registered.
  • xy_translation (TimeSeries) – Stores the x,y delta necessary to align each frame to the common coordinates, for example, to align each frame to a reference image.
  • name (str) – The name of this CorrectedImageStack container
corrected
original
xy_translation
class pynwb.behavior.MotionCorrection(source, corrected_image_stacks, name='MotionCorrection ')

Bases: pynwb.core.NWBContainer

An image stack where all frames are shifted (registered) to a common coordinate system, to account for movement and drift between frames. Note: each frame at each point in time is assumed to be 2-D (has only x & y dimensions).

Parameters:
  • source (str) – the source of the data
  • corrected_image_stacks (list or CorrectedImageStack) – the corrected image stack in this Motion Correction analysis
  • name (str) – The name of this MotionCorrection container
corrected_image_stacks