pynwb.ecephys module

class pynwb.ecephys.ElectrodeGroup(name, description, location, device, position=None)[source]

Bases: NWBContainer

Defines a related group of electrodes.

Parameters
  • name (str) – the name of this electrode group

  • description (str) – description of this electrode group

  • location (str) – description of location of this electrode group

  • device (Device) – the device that was used to record from this electrode group

  • position (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – stereotaxic position of this electrode group (x, y, z)

property description

description of this electrode group

property device

the device that was used to record from this electrode group

property location

description of location of this electrode group

namespace = 'core'
neurodata_type = 'ElectrodeGroup'
property position

stereotaxic position of this electrode group (x, y, z)

class pynwb.ecephys.ElectricalSeries(name, data, electrodes, channel_conversion=None, filtering=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, offset=0.0)[source]

Bases: TimeSeries

Stores acquired voltage data from extracellular recordings. The data field of an ElectricalSeries is an int or float array storing data in Volts. TimeSeries::data array structure: [num times] [num channels] (or [num_times] for single electrode).

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. The second dimension represents electrodes/channels.

  • electrodes (DynamicTableRegion) – the table region corresponding to the electrodes from which this series was recorded

  • channel_conversion (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Channel-specific conversion factor. Multiply the data in the ‘data’ dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the ‘conversion’ attribute of ‘data’ to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.

  • filtering (str) – Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be ‘High-pass 4-pole Bessel filter at 500 Hz’. If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be ‘Low-pass filter at 300 Hz’. If a non-standard filter type is used, provide as much detail about the filter properties as possible.

  • 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

  • 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 channel_conversion

Channel-specific conversion factor. Multiply the data in the ‘data’ dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the ‘conversion’ attribute of ‘data’ to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.

property electrodes

the electrodes that generated this electrical series

property filtering

Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be ‘High-pass 4-pole Bessel filter at 500 Hz’. If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be ‘Low-pass filter at 300 Hz’. If a non-standard filter type is used, provide as much detail about the filter properties as possible.

namespace = 'core'
neurodata_type = 'ElectricalSeries'
class pynwb.ecephys.SpikeEventSeries(name, data, timestamps, electrodes, resolution=-1.0, conversion=1.0, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)[source]

Bases: ElectricalSeries

Stores “snapshots” of spike events (i.e., threshold crossings) in data. This may also be raw data, as reported by ephys hardware. If so, the TimeSeries::description field should describing how events were detected. All SpikeEventSeries should reside in a module (under EventWaveform interface) even if the spikes were reported and stored by hardware. All events span the same recording channels and store snapshots of equal duration. TimeSeries::data array structure: [num events] [num channels] [num samples] (or [num events] [num samples] for single electrode).

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. The second dimension represents electrodes/channels.

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • electrodes (DynamicTableRegion) – the table region corresponding to the electrodes from which this series was recorded

  • 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

  • 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.

namespace = 'core'
neurodata_type = 'SpikeEventSeries'
class pynwb.ecephys.EventDetection(detection_method, source_electricalseries, source_idx, times, name='EventDetection')[source]

Bases: NWBDataInterface

Detected spike events from voltage trace(s).

Parameters
  • detection_method (str) – Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values.

  • source_electricalseries (ElectricalSeries) – The source electrophysiology data

  • source_idx (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. Module description should define what is meant by time of event (e.g., .25msec before action potential peak, zero-crossing time, etc). The index points to each event from the raw data

  • times (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Timestamps of events, in Seconds

  • name (str) – the name of this container

property detection_method

Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values.

namespace = 'core'
neurodata_type = 'EventDetection'
property source_electricalseries

The source electrophysiology data

property source_idx

Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. Module description should define what is meant by time of event (e.g., .25msec before action potential peak, zero-crossing time, etc). The index points to each event from the raw data

property times

Timestamps of events, in Seconds

class pynwb.ecephys.EventWaveform(spike_event_series={}, name='EventWaveform')[source]

Bases: MultiContainerInterface

Spike data for spike events detected in raw data stored in this NWBFile, or events detect at acquisition

Parameters
__getitem__(name=None)

Get a SpikeEventSeries from this EventWaveform

Parameters

name (str) – the name of the SpikeEventSeries

Returns

the SpikeEventSeries with the given name

Return type

SpikeEventSeries

add_spike_event_series(spike_event_series)

Add one or multiple SpikeEventSeries objects to this EventWaveform

Parameters

spike_event_series (list or tuple or dict or SpikeEventSeries) – one or multiple SpikeEventSeries objects to add to this EventWaveform

create_spike_event_series(name, data, timestamps, electrodes, resolution=-1.0, conversion=1.0, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)

Create a SpikeEventSeries object and add it to this EventWaveform

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. The second dimension represents electrodes/channels.

  • timestamps (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • electrodes (DynamicTableRegion) – the table region corresponding to the electrodes from which this series was recorded

  • 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

  • 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 SpikeEventSeries object that was created

Return type

SpikeEventSeries

get_spike_event_series(name=None)

Get a SpikeEventSeries from this EventWaveform

Parameters

name (str) – the name of the SpikeEventSeries

Returns

the SpikeEventSeries with the given name

Return type

SpikeEventSeries

namespace = 'core'
neurodata_type = 'EventWaveform'
property spike_event_series

a dictionary containing the SpikeEventSeries in this EventWaveform

class pynwb.ecephys.Clustering(description, num, peak_over_rms, times, name='Clustering')[source]

Bases: NWBDataInterface

DEPRECATED in favor of Units. Specifies cluster event times and cluster metric for maximum ratio of waveform peak to RMS on any channel in cluster.

Parameters
property description

Description of clusters or clustering, (e.g. cluster 0 is noise, clusters curated using Klusters, etc).

namespace = 'core'
neurodata_type = 'Clustering'
property num

Cluster number of each event.

property peak_over_rms

Maximum ratio of waveform peak to RMS on any channel in the cluster(provides a basic clustering metric).

property times

Times of clustered events, in seconds.

class pynwb.ecephys.ClusterWaveforms(clustering_interface, waveform_filtering, waveform_mean, waveform_sd, name='ClusterWaveforms')[source]

Bases: NWBDataInterface

DEPRECATED. ClusterWaveforms was deprecated in Oct 27, 2018 and will be removed in a future release. Please use the Units table to store waveform mean and standard deviation e.g. NWBFile.units.add_unit(…, waveform_mean=…, waveform_sd=…)

Describe cluster waveforms by mean and standard deviation for at each sample.

Parameters
  • clustering_interface (Clustering) – the clustered spike data used as input for computing waveforms

  • waveform_filtering (str) – filter applied to data before calculating mean and standard deviation

  • waveform_mean (Iterable) – the mean waveform for each cluster

  • waveform_sd (Iterable) – the standard deviations of waveforms for each cluster

  • name (str) – the name of this container

property clustering_interface

the clustered spike data used as input for computing waveforms

namespace = 'core'
neurodata_type = 'ClusterWaveforms'
property waveform_filtering

filter applied to data before calculating mean and standard deviation

property waveform_mean

the mean waveform for each cluster

property waveform_sd

the standard deviations of waveforms for each cluster

class pynwb.ecephys.LFP(electrical_series={}, name='LFP')[source]

Bases: MultiContainerInterface

LFP data from one or more channels. The electrode map in each published ElectricalSeries will identify which channels are providing LFP data. Filter properties should be noted in the ElectricalSeries description or comments field.

Parameters
__getitem__(name=None)

Get an ElectricalSeries from this LFP

Parameters

name (str) – the name of the ElectricalSeries

Returns

the ElectricalSeries with the given name

Return type

ElectricalSeries

add_electrical_series(electrical_series)

Add one or multiple ElectricalSeries objects to this LFP

Parameters

electrical_series (list or tuple or dict or ElectricalSeries) – one or multiple ElectricalSeries objects to add to this LFP

create_electrical_series(name, data, electrodes, channel_conversion=None, filtering=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, offset=0.0)

Create an ElectricalSeries object and add it to this LFP

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. The second dimension represents electrodes/channels.

  • electrodes (DynamicTableRegion) – the table region corresponding to the electrodes from which this series was recorded

  • channel_conversion (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Channel-specific conversion factor. Multiply the data in the ‘data’ dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the ‘conversion’ attribute of ‘data’ to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.

  • filtering (str) – Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be ‘High-pass 4-pole Bessel filter at 500 Hz’. If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be ‘Low-pass filter at 300 Hz’. If a non-standard filter type is used, provide as much detail about the filter properties as possible.

  • 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

  • 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 ElectricalSeries object that was created

Return type

ElectricalSeries

property electrical_series

a dictionary containing the ElectricalSeries in this LFP

get_electrical_series(name=None)

Get an ElectricalSeries from this LFP

Parameters

name (str) – the name of the ElectricalSeries

Returns

the ElectricalSeries with the given name

Return type

ElectricalSeries

namespace = 'core'
neurodata_type = 'LFP'
class pynwb.ecephys.FilteredEphys(electrical_series={}, name='FilteredEphys')[source]

Bases: MultiContainerInterface

Ephys data from one or more channels that has been subjected to filtering. Examples of filtered data include Theta and Gamma (LFP has its own interface). FilteredEphys modules publish an ElectricalSeries for each filtered channel or set of channels. The name of each ElectricalSeries is arbitrary but should be informative. The source of the filtered data, whether this is from analysis of another time series or as acquired by hardware, should be noted in each’s TimeSeries::description field. There is no assumed 1::1 correspondence between filtered ephys signals and electrodes, as a single signal can apply to many nearby electrodes, and one electrode may have different filtered (e.g., theta and/or gamma) signals represented.

Parameters
__getitem__(name=None)

Get an ElectricalSeries from this FilteredEphys

Parameters

name (str) – the name of the ElectricalSeries

Returns

the ElectricalSeries with the given name

Return type

ElectricalSeries

add_electrical_series(electrical_series)

Add one or multiple ElectricalSeries objects to this FilteredEphys

Parameters

electrical_series (list or tuple or dict or ElectricalSeries) – one or multiple ElectricalSeries objects to add to this FilteredEphys

create_electrical_series(name, data, electrodes, channel_conversion=None, filtering=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, offset=0.0)

Create an ElectricalSeries object and add it to this FilteredEphys

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. The second dimension represents electrodes/channels.

  • electrodes (DynamicTableRegion) – the table region corresponding to the electrodes from which this series was recorded

  • channel_conversion (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Channel-specific conversion factor. Multiply the data in the ‘data’ dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the ‘conversion’ attribute of ‘data’ to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.

  • filtering (str) – Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be ‘High-pass 4-pole Bessel filter at 500 Hz’. If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be ‘Low-pass filter at 300 Hz’. If a non-standard filter type is used, provide as much detail about the filter properties as possible.

  • 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

  • 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 ElectricalSeries object that was created

Return type

ElectricalSeries

property electrical_series

a dictionary containing the ElectricalSeries in this FilteredEphys

get_electrical_series(name=None)

Get an ElectricalSeries from this FilteredEphys

Parameters

name (str) – the name of the ElectricalSeries

Returns

the ElectricalSeries with the given name

Return type

ElectricalSeries

namespace = 'core'
neurodata_type = 'FilteredEphys'
class pynwb.ecephys.FeatureExtraction(electrodes, description, times, features, name='FeatureExtraction')[source]

Bases: NWBDataInterface

Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEvent TimeSeries or other source.

Parameters
property electrodes

the table region corresponding to the electrodes from which this series was recorded

property description

A description for each feature extracted

property times

The times of events that features correspond to

property features

Features for each channel

namespace = 'core'
neurodata_type = 'FeatureExtraction'