pynwb.icephys module

pynwb.icephys.ensure_unit(self, name, current_unit, unit, nwb_version)[source]

A helper to ensure correct unit used.

Issues a warning with details if current_unit is to be ignored, and unit to be used instead.

class pynwb.icephys.IntracellularElectrode(name, device, description, slice=None, seal=None, location=None, resistance=None, filtering=None, initial_access_resistance=None, cell_id=None)[source]

Bases: NWBContainer

Describes an intracellular electrode and associated metadata.

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

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

  • description (str) – Recording description, description of electrode (e.g., whole-cell, sharp, etc).

  • slice (str) – Information about slice used for recording.

  • seal (str) – Information about seal used for recording.

  • location (str) – Area, layer, comments on estimation, stereotaxis coordinates (if in vivo, etc).

  • resistance (str) – Electrode resistance, unit - Ohm.

  • filtering (str) – Electrode specific filtering.

  • initial_access_resistance (str) – Initial access resistance.

  • cell_id (str) – Unique ID of cell.

property cell_id

Unique ID of cell.

property description

Recording description, description of electrode (e.g., whole-cell, sharp, etc).

property device

the device that was used to record from this electrode

property filtering

Electrode specific filtering.

property initial_access_resistance

Initial access resistance.

property location

Area, layer, comments on estimation, stereotaxis coordinates (if in vivo, etc).

namespace = 'core'
neurodata_type = 'IntracellularElectrode'
property resistance

Electrode resistance, unit - Ohm.

property seal

Information about seal used for recording.

property slice

Information about slice used for recording.

class pynwb.icephys.PatchClampSeries(name, data, unit, electrode, gain, stimulus_description='N/A', 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, sweep_number=None)[source]

Bases: TimeSeries

Stores stimulus or response current or voltage. Superclass definition for patch-clamp data (this class should not be instantiated directly).

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

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

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units: Volt/Amp (v-clamp) or Volt/Volt (c-clamp)

  • stimulus_description (str) – the stimulus name/protocol

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

property electrode

IntracellularElectrode group that describes the electrode that was used to apply or record this data.

property gain

Volt/Amp (v-clamp) or Volt/Volt (c-clamp)

Type:

Units

property stimulus_description

the stimulus name/protocol

property sweep_number

Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

namespace = 'core'
neurodata_type = 'PatchClampSeries'
class pynwb.icephys.CurrentClampSeries(name, data, electrode, gain, stimulus_description='N/A', bias_current=None, bridge_balance=None, capacitance_compensation=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, sweep_number=None, offset=0.0, unit='volts')[source]

Bases: PatchClampSeries

Stores voltage data recorded from intracellular current-clamp recordings. A corresponding CurrentClampStimulusSeries (stored separately as a stimulus) is used to store the current injected.

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units - Volt/Volt

  • stimulus_description (str) – the stimulus name/protocol

  • bias_current (float) – Unit - Amp

  • bridge_balance (float) – Unit - Ohm

  • capacitance_compensation (float) – Unit - Farad

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

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

  • unit (str) – The base unit of measurement (must be ‘volts’)

property bias_current

Unit - Amp

property bridge_balance

Unit - Ohm

property capacitance_compensation

Unit - Farad

namespace = 'core'
neurodata_type = 'CurrentClampSeries'
class pynwb.icephys.IZeroClampSeries(name, data, electrode, gain, stimulus_description='N/A', resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, sweep_number=None, offset=0.0, unit='volts')[source]

Bases: CurrentClampSeries

Stores recorded voltage data from intracellular recordings when all current and amplifier settings are off (i.e., CurrentClampSeries fields will be zero). There is no CurrentClampStimulusSeries associated with an IZero series because the amplifier is disconnected and no stimulus can reach the cell.

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units: Volt/Volt

  • stimulus_description (str) – The stimulus name/protocol. Setting this to a value other than “N/A” is deprecated as of NWB 2.3.0.

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

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

  • unit (str) – The base unit of measurement (must be ‘volts’)

namespace = 'core'
neurodata_type = 'IZeroClampSeries'
class pynwb.icephys.CurrentClampStimulusSeries(name, data, electrode, gain, stimulus_description='N/A', resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, sweep_number=None, offset=0.0, unit='amperes')[source]

Bases: PatchClampSeries

Alias to standard PatchClampSeries. Its functionality is to better tag PatchClampSeries for machine (and human) readability of the file.

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units: Volt/Amp (v-clamp) or Volt/Volt (c-clamp)

  • stimulus_description (str) – the stimulus name/protocol

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

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

  • unit (str) – The base unit of measurement (must be ‘amperes’)

namespace = 'core'
neurodata_type = 'CurrentClampStimulusSeries'
class pynwb.icephys.VoltageClampSeries(name, data, electrode, gain, stimulus_description='N/A', capacitance_fast=None, capacitance_slow=None, resistance_comp_bandwidth=None, resistance_comp_correction=None, resistance_comp_prediction=None, whole_cell_capacitance_comp=None, whole_cell_series_resistance_comp=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, sweep_number=None, offset=0.0, unit='amperes')[source]

Bases: PatchClampSeries

Stores current data recorded from intracellular voltage-clamp recordings. A corresponding VoltageClampStimulusSeries (stored separately as a stimulus) is used to store the voltage injected.

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units - Volt/Amp

  • stimulus_description (str) – the stimulus name/protocol

  • capacitance_fast (float) – Unit - Farad

  • capacitance_slow (float) – Unit - Farad

  • resistance_comp_bandwidth (float) – Unit - Hz

  • resistance_comp_correction (float) – Unit - percent

  • resistance_comp_prediction (float) – Unit - percent

  • whole_cell_capacitance_comp (float) – Unit - Farad

  • whole_cell_series_resistance_comp (float) – Unit - Ohm

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

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

  • unit (str) – The base unit of measurement (must be ‘amperes’)

property capacitance_fast

Unit - Farad

property capacitance_slow

Unit - Farad

property resistance_comp_bandwidth

Unit - Hz

property resistance_comp_correction

Unit - percent

property resistance_comp_prediction

Unit - percent

property whole_cell_capacitance_comp

Unit - Farad

property whole_cell_series_resistance_comp

Unit - Ohm

namespace = 'core'
neurodata_type = 'VoltageClampSeries'
class pynwb.icephys.VoltageClampStimulusSeries(name, data, electrode, gain, stimulus_description='N/A', resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, sweep_number=None, offset=0.0, unit='volts')[source]

Bases: PatchClampSeries

Alias to standard PatchClampSeries. Its functionality is to better tag PatchClampSeries for machine (and human) readability of the file.

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

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. The first dimension must be time.

  • electrode (IntracellularElectrode) – IntracellularElectrode group that describes the electrode that was used to apply or record this data.

  • gain (float) – Units: Volt/Amp (v-clamp) or Volt/Volt (c-clamp)

  • stimulus_description (str) – the stimulus name/protocol

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

  • sweep_number (int or uint32 or uint64) – Sweep number, allows for grouping different PatchClampSeries together via the sweep_table

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

  • unit (str) – The base unit of measurement (must be ‘volts’)

namespace = 'core'
neurodata_type = 'VoltageClampStimulusSeries'
class pynwb.icephys.SweepTable(name='sweep_table', description='A sweep table groups different PatchClampSeries together.', id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

A SweepTable allows to group PatchClampSeries together which stem from the same sweep. A sweep is a group of PatchClampSeries which have the same starting point in time.

Parameters:
add_entry(pcs)[source]

Add the passed PatchClampSeries to the sweep table.

Parameters:

pcs (PatchClampSeries) – PatchClampSeries to add to the table must have a valid sweep_number

get_series(sweep_number)[source]

Return a list of PatchClampSeries for the given sweep number.

namespace = 'core'
neurodata_type = 'SweepTable'
class pynwb.icephys.IntracellularElectrodesTable(id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

Table for storing intracellular electrode related metadata’

Parameters:
namespace = 'core'
neurodata_type = 'IntracellularElectrodesTable'
class pynwb.icephys.IntracellularStimuliTable(id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

Table for storing intracellular electrode related metadata’

Parameters:
namespace = 'core'
neurodata_type = 'IntracellularStimuliTable'
class pynwb.icephys.IntracellularResponsesTable(id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

Table for storing intracellular electrode related metadata’

Parameters:
namespace = 'core'
neurodata_type = 'IntracellularResponsesTable'
class pynwb.icephys.IntracellularRecordingsTable(id=None, columns=None, colnames=None, category_tables=None, categories=None)[source]

Bases: AlignedDynamicTable

A table to group together a stimulus and response from a single electrode and a single simultaneous_recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response.

Parameters:
add_recording(electrode=None, stimulus_start_index=None, stimulus_index_count=None, stimulus=None, stimulus_template_start_index=None, stimulus_template_index_count=None, stimulus_template=None, response_start_index=None, response_index_count=None, response=None, electrode_metadata=None, stimulus_metadata=None, response_metadata=None)[source]

Add a single recording to the IntracellularRecordingsTable table.

Typically, both stimulus and response are expected. However, in some cases only a stimulus or a response may be recodred as part of a recording. In this case, None may be given for either stimulus or response, but not both. Internally, this results in both stimulus and response pointing to the same TimeSeries, while the start_index and index_count for the invalid series will both be set to -1.

Parameters:
  • electrode (IntracellularElectrode) – The intracellular electrode used

  • stimulus_start_index (int) – Start index of the stimulus

  • stimulus_index_count (int) – Stop index of the stimulus

  • stimulus (TimeSeries) – The TimeSeries (usually a PatchClampSeries) with the stimulus

  • stimulus_template_start_index (int) – Start index of the stimulus template

  • stimulus_template_index_count (int) – Stop index of the stimulus template

  • stimulus_template (TimeSeries) – The TimeSeries (usually a PatchClampSeries) with the stimulus template waveforms

  • response_start_index (int) – Start index of the response

  • response_index_count (int) – Stop index of the response

  • response (TimeSeries) – The TimeSeries (usually a PatchClampSeries) with the response

  • electrode_metadata (dict) – Additional electrode metadata to be stored in the electrodes table

  • stimulus_metadata (dict) – Additional stimulus metadata to be stored in the stimuli table

  • response_metadata (dict) – Additional resposnse metadata to be stored in the responses table

Returns:

Integer index of the row that was added to this table

Return type:

int

to_dataframe(ignore_category_ids=False, electrode_refs_as_objectids=False, stimulus_refs_as_objectids=False, response_refs_as_objectids=False)[source]

Convert the collection of tables to a single pandas DataFrame

Parameters:
  • ignore_category_ids (bool) – Ignore id columns of sub-category tables

  • electrode_refs_as_objectids (bool) – replace object references in the electrode column with object_ids

  • stimulus_refs_as_objectids (bool) – replace object references in the stimulus column with object_ids

  • response_refs_as_objectids (bool) – replace object references in the response column with object_ids

namespace = 'core'
neurodata_type = 'IntracellularRecordingsTable'
class pynwb.icephys.SimultaneousRecordingsTable(intracellular_recordings_table=None, id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes.

Parameters:
add_simultaneous_recording(recordings)[source]
Add a single simultaneous recording (i.e., one sweep, or one row) consisting of one or more

recordings and associated custom simultaneous recording metadata to the table.

Parameters:

recordings (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator) – the indices of the recordings belonging to this simultaneous recording

Returns:

Integer index of the row that was added to this table

Return type:

int

namespace = 'core'
neurodata_type = 'SimultaneousRecordingsTable'
class pynwb.icephys.SequentialRecordingsTable(simultaneous_recordings_table=None, id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

A table for grouping different intracellular recording simultaneous_recordings from the SimultaneousRecordingsTable table together. This is typically used to group together simultaneous_recordings where the a sequence of stimuli of the same type with varying parameters have been presented in a sequence.

Parameters:
add_sequential_recording(stimulus_type, simultaneous_recordings)[source]
Add a sequential recording (i.e., one row) consisting of one or more simultaneous recordings

and associated custom sequential recording metadata to the table.

Parameters:
Returns:

Integer index of the row that was added to this table

Return type:

int

namespace = 'core'
neurodata_type = 'SequentialRecordingsTable'
class pynwb.icephys.RepetitionsTable(sequential_recordings_table=None, id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

A table for grouping different intracellular recording sequential recordings together. With each SweepSequence typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.

Parameters:
add_repetition(sequential_recordings=None)[source]
Add a repetition (i.e., one row) consisting of one or more sequential recordings

and associated custom repetition metadata to the table.

Parameters:

sequential_recordings (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator) – the indices of the sequential recordings belonging to this repetition

Returns:

Integer index of the row that was added to this table

Return type:

int

namespace = 'core'
neurodata_type = 'RepetitionsTable'
class pynwb.icephys.ExperimentalConditionsTable(repetitions_table=None, id=None, columns=None, colnames=None)[source]

Bases: DynamicTable

A table for grouping different intracellular recording repetitions together that belong to the same experimental conditions.

Parameters:
add_experimental_condition(repetitions=None)[source]
Add a condition (i.e., one row) consisting of one or more repetitions of sequential recordings

and associated custom experimental_conditions metadata to the table.

Parameters:

repetitions (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator) – the indices of the repetitions belonging to this condition

Returns:

Integer index of the row that was added to this table

Return type:

int

namespace = 'core'
neurodata_type = 'ExperimentalConditionsTable'