pynwb.misc module

class pynwb.misc.AnnotationSeries(name, data=[], timestamps=None, comments='no comments', description='no description')[source]

Bases: TimeSeries

DEPRECATED. Use an EventsTable instead, placed in the top-level /events group of the NWBFile. The timestamps field maps to the timestamp column, and the data field (annotation strings) maps to the annotation column on EventsTable. Use the source_description attribute on the EventsTable to record where the events came from (e.g., “Acquisition system”, “Thresholding of analog signal ANALOG1 at 3 V”, “Manual video review”). Original definition: Stores user annotations made during an experiment. The data[] field stores a text array, and timestamps are stored for each annotation (i.e., interval=1). This is largely an alias to a standard TimeSeries storing a text array but that is identifiable as storing annotations in a machine-readable way.

Parameters:
add_annotation(time, annotation)[source]

Add an annotation.

Parameters:
  • time (float) – The time for the annotation

  • annotation (str) – the annotation

namespace = 'core'
neurodata_type = 'AnnotationSeries'
class pynwb.misc.AbstractFeatureSeries(name, feature_units, features, data=[], resolution=-1.0, conversion=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

Represents the salient features of a data stream. Typically this will be used for things like a visual grating stimulus, where the bulk of data (each frame sent to the graphics card) is bulky and not of high value, while the salient characteristics (eg, orientation, spatial frequency, contrast, etc) are what important and are what are used for analysis

Parameters:
property features

Description of each feature

property feature_units

The unit of each feature

add_features(time, features)[source]
Parameters:
  • time (float) – the time point of this feature

  • features (list or ndarray) – the feature values for this time point

namespace = 'core'
neurodata_type = 'AbstractFeatureSeries'
class pynwb.misc.IntervalSeries(name, data=[], timestamps=None, comments='no comments', description='no description', control=None, control_description=None)[source]

Bases: TimeSeries

Stores intervals of data. The timestamps field stores the beginning and end of intervals. The data field stores whether the interval just started (>0 value) or ended (<0 value). Different interval types can be represented in the same series by using multiple key values (eg, 1 for feature A, 2 for feature B, 3 for feature C, etc). The field data stores an 8-bit integer. This is largely an alias of a standard TimeSeries but that is identifiable as representing time intervals in a machine-readable way.

Parameters:
add_interval(start, stop)[source]
Parameters:
  • start (float) – The start time of the interval

  • stop (float) – The stop time of the interval

property data
property timestamps
namespace = 'core'
neurodata_type = 'IntervalSeries'
class pynwb.misc.Units(name='Units', id=None, columns=None, colnames=None, target_tables=None, meanings_tables=None, description=None, electrode_table=None, waveform_rate=None, waveform_unit='volts', waveform_time_before_peak_in_ms=None, resolution=None)[source]

Bases: DynamicTable

Event times of observed units (e.g. cell, synapse, etc.).

Parameters:
  • name (str) – Name of this Units interface

  • id (ndarray or list or tuple or Dataset or Series or ExtensionArray or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or ElementIdentifiers) – the identifiers for this table

  • columns (tuple or list) – the columns in this table

  • colnames (ndarray or list or tuple or Dataset or Series or ExtensionArray or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator) – the ordered names of the columns in this table. columns must also be provided.

  • target_tables (dict) – dict mapping DynamicTableRegion column name to the table that the DTR points to. The column is added to the table if it is not already present (i.e., when it is optional).

  • meanings_tables (tuple or list) – MeaningsTable objects that provide meanings for values in VectorData columns. Each MeaningsTable must have a name of “{column_name}_meanings” where column_name is the name of the target column in this DynamicTable. The target column must exist in this table.

  • description (str) – a description of what is in this table

  • electrode_table (DynamicTable) – the table that the electrodes column indexes

  • waveform_rate (float) – Sampling rate of the data in the waveform_mean, waveform_sd, and waveforms columns

  • waveform_unit (str) – Unit of measurement of the data in the waveform_mean, waveform_sd, and waveforms columns

  • waveform_time_before_peak_in_ms (float) – Time, in milliseconds, from the start of each waveform in the waveform_mean, waveform_sd, and waveforms columns to the spike peak, i.e., the alignment point used during spike sorting. The same value applies to every unit in the table.

  • resolution (float) – The smallest possible difference between two spike times

waveforms_desc = 'Individual waveforms for each spike. If the dataset is three-dimensional, the third dimension shows the response from different electrodes that all observe this unit simultaneously. In this case, the `electrodes` column of this Units table should be used to indicate which electrodes are associated with this unit, and the electrodes dimension here should be in the same order as the electrodes referenced in the `electrodes` column of this table.'
add_unit(spike_times=None, obs_intervals=None, electrodes=None, electrode_group=None, waveform_mean=None, waveform_sd=None, waveforms=None, id=None)[source]

Add a unit to this table

Parameters:
get_unit_spike_times(index, in_interval=None)[source]
Parameters:
  • index (int or list or tuple or ndarray) – the index of the unit in unit_ids to retrieve spike times for

  • in_interval (tuple or list) – only return values within this interval

get_unit_obs_intervals(index)[source]
Parameters:

index (int) – the index of the unit in unit_ids to retrieve observation intervals for

get_starting_time()[source]

Get the earliest spike time across all units in this Units table.

Returns:

The earliest spike time in seconds, or None if the table is empty, has no spike_times column, or has no spike data.

Return type:

float or None

Notes

This method checks the first spike of every unit because units are not assumed to be in chronological order (the earliest spike may be in any unit).

Edge cases: - Returns None if the table is empty (no units) - Returns None if the spike_times column does not exist - Returns None if all units have empty spike_times arrays

get_duration()[source]

Get the duration from the earliest to the latest spike time across all units.

Returns:

The duration in seconds, or None if the table is empty, has no spike_times column, or has no spike data.

Return type:

float or None

Notes

The duration represents the time span from the earliest spike to the latest spike across all units, not the sum of individual unit recording durations.

This method checks the first and last spike of every unit because units are not assumed to be in chronological order (the earliest or latest spike may be in any unit).

Edge cases: - Returns None if the table is empty (no units) - Returns None if the spike_times column does not exist - Returns None if all units have empty spike_times arrays - Returns 0.0 if there is only one spike across all units

namespace = 'core'
neurodata_type = 'Units'
property resolution

The smallest possible difference between two spike times

property waveform_rate

Sampling rate of the data in the waveform_mean, waveform_sd, and waveforms columns

property waveform_time_before_peak_in_ms

Time, in milliseconds, from the start of each waveform in the waveform_mean, waveform_sd, and waveforms columns to the spike peak, i.e., the alignment point used during spike sorting. The same value applies to every unit in the table.

property waveform_unit

Unit of measurement of the data in the waveform_mean, waveform_sd, and waveforms columns

class pynwb.misc.FrequencyBandsTable(id=None, columns=None, colnames=None, target_tables=None, meanings_tables=None)[source]

Bases: DynamicTable

Table for describing the bands that DecompositionSeries was generated from.

Parameters:
add_band(band_name, band_limits, band_mean=None, band_stdev=None)[source]
Parameters:
namespace = 'core'
neurodata_type = 'FrequencyBandsTable'
class pynwb.misc.DecompositionSeries(name, data, metric, description='no description', unit='no unit', bands=None, source_timeseries=None, source_channels=None, resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', control=None, control_description=None, offset=0.0)[source]

Bases: TimeSeries

Stores product of spectral analysis

Parameters:
DEFAULT_DATA = array([], shape=(0, 0, 0), dtype=uint8)
property source_timeseries

the input TimeSeries from this analysis

property source_channels

the channels that provided the source data

property metric

metric of analysis. recommended - ‘phase’, ‘amplitude’, ‘power’

property bands

the bands that the signal is decomposed into

add_band(band_name, band_limits, band_mean=None, band_stdev=None)[source]

Add a frequency band to the bands table of this DecompositionSeries.

Parameters:
namespace = 'core'
neurodata_type = 'DecompositionSeries'