pynwb.file module

class pynwb.file.LabMetaData(name)[source]

Bases: NWBContainer

Container for storing lab-specific meta-data

The LabMetaData class serves as a base type for defining lab specific meta-data. To define your own lab-specific metadata, create a Neurodata Extension (NDX) for NWB that defines the data to add. Using the LabMetaData container as a base type makes it easy to add your data to an NWBFile without having to modify the NWBFile type itself, since adding of LabMetaData is already implemented. For more details on how to create an extension see the Extending NWB tutorial.

Parameters

name (str) – name of lab metadata

namespace = 'core'
neurodata_type = 'LabMetaData'
class pynwb.file.Subject(age=None, description=None, genotype=None, sex=None, species=None, subject_id=None, weight=None, date_of_birth=None, strain=None)[source]

Bases: NWBContainer

Subject information and metadata.

Parameters
  • age (str) – The age of the subject. The ISO 8601 Duration format is recommended, e.g., “P90D” for 90 days old.

  • description (str) – A description of the subject, e.g., “mouse A10”.

  • genotype (str) – The genotype of the subject, e.g., “Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt”.

  • sex (str) – The sex of the subject. Using “F” (female), “M” (male), “U” (unknown), or “O” (other) is recommended.

  • species (str) – The species of the subject. The formal latin binomal name is recommended, e.g., “Mus musculus”

  • subject_id (str) – A unique identifier for the subject, e.g., “A10”

  • weight (float or str) – The weight of the subject, including units. Using kilograms is recommended. e.g., “0.02 kg”. If a float is provided, then the weight will be stored as “[value] kg”.

  • date_of_birth (datetime) – The datetime of the date of birth. May be supplied instead of age.

  • strain (str) – The strain of the subject, e.g., “C57BL/6J”

property age

The age of the subject. The ISO 8601 Duration format is recommended, e.g., “P90D” for 90 days old.

property date_of_birth

The datetime of the date of birth. May be supplied instead of age.

property description

A description of the subject, e.g., “mouse A10”.

property genotype

The genotype of the subject, e.g., “Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt”.

namespace = 'core'
neurodata_type = 'Subject'
property sex

The sex of the subject. Using “F” (female), “M” (male), “U” (unknown), or “O” (other) is recommended.

property species

The species of the subject. The formal latin binomal name is recommended, e.g., “Mus musculus”

property strain

The strain of the subject, e.g., “C57BL/6J”

property subject_id

A unique identifier for the subject, e.g., “A10”

property weight

The weight of the subject, including units. Using kilograms is recommended. e.g., “0.02 kg”. If a float is provided, then the weight will be stored as “[value] kg”.

class pynwb.file.NWBFile(session_description, identifier, session_start_time, file_create_date=None, timestamps_reference_time=None, experimenter=None, experiment_description=None, session_id=None, institution=None, keywords=None, notes=None, pharmacology=None, protocol=None, related_publications=None, slices=None, source_script=None, source_script_file_name=None, data_collection=None, surgery=None, virus=None, stimulus_notes=None, lab=None, acquisition=None, analysis=None, stimulus=None, stimulus_template=None, epochs=None, epoch_tags=set(), trials=None, invalid_times=None, intervals=None, units=None, processing=None, lab_meta_data=None, electrodes=None, electrode_groups=None, ic_electrodes=None, sweep_table=None, imaging_planes=None, ogen_sites=None, devices=None, subject=None, scratch=None, icephys_electrodes=None, icephys_filtering=None, intracellular_recordings=None, icephys_simultaneous_recordings=None, icephys_sequential_recordings=None, icephys_repetitions=None, icephys_experimental_conditions=None)[source]

Bases: MultiContainerInterface

A representation of an NWB file.

Parameters
  • session_description (str) – a description of the session where this data was generated

  • identifier (str) – a unique text identifier for the file

  • session_start_time (datetime) – the start date and time of the recording session

  • file_create_date (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or datetime) – the date and time the file was created and subsequent modifications made

  • timestamps_reference_time (datetime) – date and time corresponding to time zero of all timestamps; defaults to value of session_start_time

  • experimenter (tuple or list or str) – name of person who performed experiment

  • experiment_description (str) – general description of the experiment

  • session_id (str) – lab-specific ID for the session

  • institution (str) – institution(s) where experiment is performed

  • keywords (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – Terms to search over

  • notes (str) – Notes about the experiment.

  • pharmacology (str) – Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.

  • protocol (str) – Experimental protocol, if applicable. E.g., include IACUC protocol

  • related_publications (tuple or list or str) – Publication information.PMID, DOI, URL, etc. If multiple, concatenate together and describe which is which. such as PMID, DOI, URL, etc

  • slices (str) – Description of slices, including information about preparation thickness, orientation, temperature and bath solution

  • source_script (str) – Script file used to create this NWB file.

  • source_script_file_name (str) – Name of the source_script file

  • data_collection (str) – Notes about data collection and analysis.

  • surgery (str) – Narrative description about surgery/surgeries, including date(s) and who performed surgery.

  • virus (str) – Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.

  • stimulus_notes (str) – Notes about stimuli, such as how and where presented.

  • lab (str) – lab where experiment was performed

  • acquisition (list or tuple) – Raw TimeSeries objects belonging to this NWBFile

  • analysis (list or tuple) – result of analysis

  • stimulus (list or tuple) – Stimulus TimeSeries objects belonging to this NWBFile

  • stimulus_template (list or tuple) – Stimulus template TimeSeries objects belonging to this NWBFile

  • epochs (TimeIntervals) – Epoch objects belonging to this NWBFile

  • epoch_tags (tuple or list or set) – A sorted list of tags used across all epochs

  • trials (TimeIntervals) – A table containing trial data

  • invalid_times (TimeIntervals) – A table containing times to be omitted from analysis

  • intervals (list or tuple) – any TimeIntervals tables storing time intervals

  • units (Units) – A table containing unit metadata

  • processing (list or tuple) – ProcessingModule objects belonging to this NWBFile

  • lab_meta_data (list or tuple) – an extension that contains lab-specific meta-data

  • electrodes (DynamicTable) – the ElectrodeTable that belongs to this NWBFile

  • electrode_groups (Iterable) – the ElectrodeGroups that belong to this NWBFile

  • ic_electrodes (list or tuple) – DEPRECATED use icephys_electrodes parameter instead. IntracellularElectrodes that belong to this NWBFile

  • sweep_table (SweepTable) – the SweepTable that belong to this NWBFile

  • imaging_planes (list or tuple) – ImagingPlanes that belong to this NWBFile

  • ogen_sites (list or tuple) – OptogeneticStimulusSites that belong to this NWBFile

  • devices (list or tuple) – Device objects belonging to this NWBFile

  • subject (Subject) – subject metadata

  • scratch (list or tuple) – scratch data

  • icephys_electrodes (list or tuple) – IntracellularElectrodes that belong to this NWBFile.

  • icephys_filtering (str) – [DEPRECATED] Use IntracellularElectrode.filtering instead. Description of filtering used.

  • intracellular_recordings (IntracellularRecordingsTable) – the IntracellularRecordingsTable table that belongs to this NWBFile

  • icephys_simultaneous_recordings (SimultaneousRecordingsTable) – the SimultaneousRecordingsTable table that belongs to this NWBFile

  • icephys_sequential_recordings (SequentialRecordingsTable) – the SequentialRecordingsTable table that belongs to this NWBFile

  • icephys_repetitions (RepetitionsTable) – the RepetitionsTable table that belongs to this NWBFile

  • icephys_experimental_conditions (ExperimentalConditionsTable) – the ExperimentalConditionsTable table that belongs to this NWBFile

all_children()[source]
property objects
property modules
property ec_electrode_groups
property ec_electrodes
property ic_electrodes
property icephys_filtering
add_ic_electrode(*args, **kwargs)[source]

This method is deprecated and will be removed in future versions. Please use add_icephys_electrode instead

create_ic_electrode(*args, **kwargs)[source]

This method is deprecated and will be removed in future versions. Please use create_icephys_electrode instead

get_ic_electrode(*args, **kwargs)[source]

This method is deprecated and will be removed in future versions. Please use get_icephys_electrode instead

add_epoch_column(name, description, data=[], table=False, index=False, enum=False, col_cls=<class 'hdmf.common.table.VectorData'>)[source]
Add a column to the epoch table.

See add_column for more details

Parameters
  • name (str) – the name of this VectorData

  • description (str) – a description for this column

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – a dataset where the first dimension is a concatenation of multiple vectors

  • table (bool or DynamicTable) – whether or not this is a table region or the table the region applies to

  • index (bool or VectorIndex or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or int) –

    • False (default): do not generate a VectorIndex

    • True: generate one empty VectorIndex

    • VectorIndex: Use the supplied VectorIndex

    • array-like of ints: Create a VectorIndex and use these values as the data

    • int: Recursively create n VectorIndex objects for a multi-ragged array

  • enum (bool or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – whether or not this column contains data from a fixed set of elements

  • col_cls (type) – class to use to represent the column data. If table=True, this field is ignored and a DynamicTableRegion object is used. If enum=True, this field is ignored and a EnumData object is used.

add_epoch_metadata_column(*args, **kwargs)[source]

This method is deprecated and will be removed in future versions. Please use add_epoch_column instead

add_epoch(start_time, stop_time, tags=None, timeseries=None)[source]
Creates a new Epoch object. Epochs are used to track intervals

in an experiment, such as exposure to a certain type of stimuli (an interval where orientation gratings are shown, or of sparse noise) or a different paradigm (a rat exploring an enclosure versus sleeping between explorations)

Parameters
  • start_time (float) – Start time of epoch, in seconds

  • stop_time (float) – Stop time of epoch, in seconds

  • tags (str or list or tuple) – user-defined tags used throughout time intervals

  • timeseries (list or tuple or TimeSeries) – the TimeSeries this epoch applies to

add_electrode_column(name, description, data=[], table=False, index=False, enum=False, col_cls=<class 'hdmf.common.table.VectorData'>)[source]
Add a column to the electrode table.

See add_column for more details

Parameters
  • name (str) – the name of this VectorData

  • description (str) – a description for this column

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – a dataset where the first dimension is a concatenation of multiple vectors

  • table (bool or DynamicTable) – whether or not this is a table region or the table the region applies to

  • index (bool or VectorIndex or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or int) –

    • False (default): do not generate a VectorIndex

    • True: generate one empty VectorIndex

    • VectorIndex: Use the supplied VectorIndex

    • array-like of ints: Create a VectorIndex and use these values as the data

    • int: Recursively create n VectorIndex objects for a multi-ragged array

  • enum (bool or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – whether or not this column contains data from a fixed set of elements

  • col_cls (type) – class to use to represent the column data. If table=True, this field is ignored and a DynamicTableRegion object is used. If enum=True, this field is ignored and a EnumData object is used.

add_electrode(x=None, y=None, z=None, imp=None, location=None, filtering=None, group=None, id=None, rel_x=None, rel_y=None, rel_z=None, reference=None, enforce_unique_id=True)[source]
Add an electrode to the electrodes table.

See add_row for more details.

Required fields are location and group and any columns that have been added (through calls to add_electrode_columns).

Parameters
  • x (float) – the x coordinate of the position (+x is posterior)

  • y (float) – the y coordinate of the position (+y is inferior)

  • z (float) – the z coordinate of the position (+z is right)

  • imp (float) – the impedance of the electrode, in ohms

  • location (str) – the location of electrode within the subject e.g. brain region. Required.

  • filtering (str) – description of hardware filtering, including the filter name and frequency cutoffs

  • group (ElectrodeGroup) – the ElectrodeGroup object to add to this NWBFile. Required.

  • id (int) – a unique identifier for the electrode

  • rel_x (float) – the x coordinate within the electrode group

  • rel_y (float) – the y coordinate within the electrode group

  • rel_z (float) – the z coordinate within the electrode group

  • reference (str) – Description of the reference electrode and/or reference scheme used for this electrode, e.g.,”stainless steel skull screw” or “online common average referencing”.

  • enforce_unique_id (bool) – enforce that the id in the table must be unique

create_electrode_table_region(region, description, name='electrodes')[source]
Parameters
  • region (slice or list or tuple) – the indices of the table

  • description (str) – a brief description of what this electrode is

  • name (str) – the name of this container

add_unit_column(name, description, data=[], table=False, index=False, enum=False, col_cls=<class 'hdmf.common.table.VectorData'>)[source]
Add a column to the unit table.

See add_column for more details

Parameters
  • name (str) – the name of this VectorData

  • description (str) – a description for this column

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – a dataset where the first dimension is a concatenation of multiple vectors

  • table (bool or DynamicTable) – whether or not this is a table region or the table the region applies to

  • index (bool or VectorIndex or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or int) –

    • False (default): do not generate a VectorIndex

    • True: generate one empty VectorIndex

    • VectorIndex: Use the supplied VectorIndex

    • array-like of ints: Create a VectorIndex and use these values as the data

    • int: Recursively create n VectorIndex objects for a multi-ragged array

  • enum (bool or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – whether or not this column contains data from a fixed set of elements

  • col_cls (type) – class to use to represent the column data. If table=True, this field is ignored and a DynamicTableRegion object is used. If enum=True, this field is ignored and a EnumData object is used.

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 the unit table.

See add_row for more details.

Parameters
add_trial_column(name, description, data=[], table=False, index=False, enum=False, col_cls=<class 'hdmf.common.table.VectorData'>)[source]
Add a column to the trial table.

See add_column for more details

Parameters
  • name (str) – the name of this VectorData

  • description (str) – a description for this column

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – a dataset where the first dimension is a concatenation of multiple vectors

  • table (bool or DynamicTable) – whether or not this is a table region or the table the region applies to

  • index (bool or VectorIndex or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or int) –

    • False (default): do not generate a VectorIndex

    • True: generate one empty VectorIndex

    • VectorIndex: Use the supplied VectorIndex

    • array-like of ints: Create a VectorIndex and use these values as the data

    • int: Recursively create n VectorIndex objects for a multi-ragged array

  • enum (bool or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – whether or not this column contains data from a fixed set of elements

  • col_cls (type) – class to use to represent the column data. If table=True, this field is ignored and a DynamicTableRegion object is used. If enum=True, this field is ignored and a EnumData object is used.

add_trial(start_time, stop_time, tags=None, timeseries=None)[source]
Add a trial to the trial table.

See add_interval for more details.

Required fields are start_time, stop_time, and any columns that have been added (through calls to add_trial_columns).

Parameters
  • start_time (float) – Start time of epoch, in seconds

  • stop_time (float) – Stop time of epoch, in seconds

  • tags (str or list or tuple) – user-defined tags used throughout time intervals

  • timeseries (list or tuple or TimeSeries) – the TimeSeries this epoch applies to

add_invalid_times_column(name, description, data=[], table=False, index=False, enum=False, col_cls=<class 'hdmf.common.table.VectorData'>)[source]
Add a column to the invalid times table.

See add_column for more details

Parameters
  • name (str) – the name of this VectorData

  • description (str) – a description for this column

  • data (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – a dataset where the first dimension is a concatenation of multiple vectors

  • table (bool or DynamicTable) – whether or not this is a table region or the table the region applies to

  • index (bool or VectorIndex or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator or int) –

    • False (default): do not generate a VectorIndex

    • True: generate one empty VectorIndex

    • VectorIndex: Use the supplied VectorIndex

    • array-like of ints: Create a VectorIndex and use these values as the data

    • int: Recursively create n VectorIndex objects for a multi-ragged array

  • enum (bool or ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – whether or not this column contains data from a fixed set of elements

  • col_cls (type) – class to use to represent the column data. If table=True, this field is ignored and a DynamicTableRegion object is used. If enum=True, this field is ignored and a EnumData object is used.

add_invalid_time_interval(start_time, stop_time, tags=None, timeseries=None)[source]
Add a time interval to the invalid times table.

See add_row for more details.

Required fields are start_time, stop_time, and any columns that have been added (through calls to add_invalid_times_columns).

Parameters
  • start_time (float) – Start time of epoch, in seconds

  • stop_time (float) – Stop time of epoch, in seconds

  • tags (str or list or tuple) – user-defined tags used throughout time intervals

  • timeseries (list or tuple or TimeSeries) – the TimeSeries this epoch applies to

set_electrode_table(electrode_table)[source]

Set the electrode table of this NWBFile to an existing ElectrodeTable

Parameters

electrode_table (DynamicTable) – the ElectrodeTable for this file

add_acquisition(nwbdata, use_sweep_table=False)[source]
Parameters
add_stimulus(timeseries, use_sweep_table=False)[source]
Parameters
  • timeseries (TimeSeries) – None

  • use_sweep_table (bool) – Use the deprecated SweepTable

add_stimulus_template(timeseries, use_sweep_table=False)[source]
Parameters
  • timeseries (TimeSeries) – None

  • use_sweep_table (bool) – Use the deprecated SweepTable

get_intracellular_recordings()[source]

Get the NWBFile.intracellular_recordings table.

In contrast to NWBFile.intracellular_recordings, this function will create the IntracellularRecordingsTable table if not yet done, whereas NWBFile.intracellular_recordings will return None if the table is currently not being used.

Returns

The NWBFile.intracellular_recordings table

Return type

IntracellularRecordingsTable

add_intracellular_recording(electrode, stimulus_start_index=None, stimulus_index_count=None, stimulus=None, response_start_index=None, response_index_count=None, response=None, electrode_metadata=None, stimulus_metadata=None, response_metadata=None)[source]
Add a intracellular recording to the intracellular_recordings table. If the

electrode, stimulus, and/or response do not exist yet in the NWBFile, then they will be added to this NWBFile before adding them to the table.

Note: For more complex organization of intracellular recordings you may also be interested in the related SimultaneousRecordingsTable, SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditionsTable tables and the related functions of NWBFile: add_icephys_simultaneous_recording, add_icephys_sequential_recording, add_icephys_repetition, and add_icephys_experimental_condition.

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

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

Return type

int

get_icephys_simultaneous_recordings()[source]

Get the NWBFile.icephys_simultaneous_recordings table.

In contrast to NWBFile.icephys_simultaneous_recordings, this function will create the SimultaneousRecordingsTable table if not yet done, whereas NWBFile.icephys_simultaneous_recordings will return None if the table is currently not being used.

Returns

The NWBFile.icephys_simultaneous_recordings table

Return type

SimultaneousRecordingsTable

add_icephys_simultaneous_recording(recordings)[source]

Add a new simultaneous recording to the icephys_simultaneous_recordings table

Parameters

recordings (ndarray or list or tuple or Dataset 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 SimultaneousRecordingsTable

Return type

int

get_icephys_sequential_recordings()[source]

Get the NWBFile.icephys_sequential_recordings table.

In contrast to NWBFile.icephys_sequential_recordings, this function will create the IntracellularRecordingsTable table if not yet done, whereas NWBFile.icephys_sequential_recordings will return None if the table is currently not being used.

Returns

The NWBFile.icephys_sequential_recordings table

Return type

SequentialRecordingsTable

add_icephys_sequential_recording(stimulus_type, simultaneous_recordings)[source]

Add a new sequential recording to the icephys_sequential_recordings table

Parameters
Returns

Integer index of the row that was added to SequentialRecordingsTable

Return type

int

get_icephys_repetitions()[source]

Get the NWBFile.icephys_repetitions table.

In contrast to NWBFile.icephys_repetitions, this function will create the RepetitionsTable table if not yet done, whereas NWBFile.icephys_repetitions will return None if the table is currently not being used.

Returns

The NWBFile.icephys_repetitions table

Return type

RepetitionsTable

add_icephys_repetition(sequential_recordings=None)[source]

Add a new repetition to the RepetitionsTable table

Parameters

sequential_recordings (ndarray or list or tuple or Dataset 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 RepetitionsTable

Return type

int

get_icephys_experimental_conditions()[source]

Get the NWBFile.icephys_experimental_conditions table.

In contrast to NWBFile.icephys_experimental_conditions, this function will create the RepetitionsTable table if not yet done, whereas NWBFile.icephys_experimental_conditions will return None if the table is currently not being used.

Returns

The NWBFile.icephys_experimental_conditions table

Return type

ExperimentalConditionsTable

add_icephys_experimental_condition(repetitions=None)[source]

Add a new condition to the ExperimentalConditionsTable table

Parameters

repetitions (ndarray or list or tuple or Dataset 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 ExperimentalConditionsTable

Return type

int

get_icephys_meta_parent_table()[source]

Get the top-most table in the intracellular ephys metadata table hierarchy that exists in this NWBFile.

The intracellular ephys metadata consists of a hierarchy of DynamicTables, i.e., experimental_conditions –> repetitions –> sequential_recordings –> simultaneous_recordings –> intracellular_recordings etc. In a given NWBFile not all tables may exist. This convenience functions returns the top-most table that exists in this file. E.g., if the file contains only the simultaneous_recordings and intracellular_recordings tables then the function would return the simultaneous_recordings table. Similarly, if the file contains all tables then it will return the experimental_conditions table.

Returns

DynamicTable object or None

add_scratch(data, name=None, notes=None, table_description='', description=None)[source]

Add data to the scratch space

Parameters
  • data (str or int or float or bytes or bool or ndarray or list or tuple or DataFrame or DynamicTable or NWBContainer or ScratchData) – The data to add to the scratch space.

  • name (str) – The name of the data. Required only when passing in a scalar, numpy.ndarray, list, or tuple

  • notes (str) – Notes to add to the data. Only used when passing in numpy.ndarray, list, or tuple. This argument is not recommended. Use the description argument instead.

  • table_description (str) – Description for the internal DynamicTable used to store a pandas.DataFrame. This argument is not recommended. Use the description argument instead.

  • description (str) – Description of the data. Required only when passing in a scalar, numpy.ndarray, list, tuple, or pandas.DataFrame. Ignored when passing in an NWBContainer, DynamicTable, or ScratchData object.

get_scratch(name, convert=True)[source]

Get data from the scratch space

Parameters
  • name (str) – the name of the object to get

  • convert (bool) – return the original data, not the NWB object

copy()[source]

Shallow copy of an NWB file. Useful for linking across files.

property acquisition

a dictionary containing the NWBDataInterface or DynamicTable in this NWBFile

add_analysis(analysis)

Add one or multiple NWBContainer or DynamicTable objects to this NWBFile

Parameters

analysis (list or tuple or dict or NWBContainer or DynamicTable) – one or multiple NWBContainer or DynamicTable objects to add to this NWBFile

add_device(devices)

Add one or multiple Device objects to this NWBFile

Parameters

devices (list or tuple or dict or Device) – one or multiple Device objects to add to this NWBFile

add_electrode_group(electrode_groups)

Add one or multiple ElectrodeGroup objects to this NWBFile

Parameters

electrode_groups (list or tuple or dict or ElectrodeGroup) – one or multiple ElectrodeGroup objects to add to this NWBFile

add_icephys_electrode(icephys_electrodes)

Add one or multiple IntracellularElectrode objects to this NWBFile

Parameters

icephys_electrodes (list or tuple or dict or IntracellularElectrode) – one or multiple IntracellularElectrode objects to add to this NWBFile

add_imaging_plane(imaging_planes)

Add one or multiple ImagingPlane objects to this NWBFile

Parameters

imaging_planes (list or tuple or dict or ImagingPlane) – one or multiple ImagingPlane objects to add to this NWBFile

add_lab_meta_data(lab_meta_data)

Add one or multiple LabMetaData objects to this NWBFile

Parameters

lab_meta_data (list or tuple or dict or LabMetaData) – one or multiple LabMetaData objects to add to this NWBFile

add_ogen_site(ogen_sites)

Add one or multiple OptogeneticStimulusSite objects to this NWBFile

Parameters

ogen_sites (list or tuple or dict or OptogeneticStimulusSite) – one or multiple OptogeneticStimulusSite objects to add to this NWBFile

add_processing_module(processing)

Add one or multiple ProcessingModule objects to this NWBFile

Parameters

processing (list or tuple or dict or ProcessingModule) – one or multiple ProcessingModule objects to add to this NWBFile

add_time_intervals(intervals)

Add one or multiple TimeIntervals objects to this NWBFile

Parameters

intervals (list or tuple or dict or TimeIntervals) – one or multiple TimeIntervals objects to add to this NWBFile

property analysis

a dictionary containing the NWBContainer or DynamicTable in this NWBFile

create_device(name, description=None, manufacturer=None)

Create a Device object and add it to this NWBFile

Parameters
  • name (str) – the name of this device

  • description (str) – Description of the device (e.g., model, firmware version, processing software version, etc.)

  • manufacturer (str) – the name of the manufacturer of this device

Returns

the Device object that was created

Return type

Device

create_electrode_group(name, description, location, device, position=None)

Create an ElectrodeGroup object and add it to this NWBFile

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)

Returns

the ElectrodeGroup object that was created

Return type

ElectrodeGroup

create_icephys_electrode(name, device, description, slice=None, seal=None, location=None, resistance=None, filtering=None, initial_access_resistance=None, cell_id=None)

Create an IntracellularElectrode object and add it to this NWBFile

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.

Returns

the IntracellularElectrode object that was created

Return type

IntracellularElectrode

create_imaging_plane(name, optical_channel, description, device, excitation_lambda, indicator, location, imaging_rate=None, manifold=None, conversion=1.0, unit='meters', reference_frame=None, origin_coords=None, origin_coords_unit='meters', grid_spacing=None, grid_spacing_unit='meters')

Create an ImagingPlane object and add it to this NWBFile

Parameters
  • name (str) – the name of this container

  • optical_channel (list or OpticalChannel) – One of possibly many groups storing channel-specific data.

  • description (str) – Description of this ImagingPlane.

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

  • excitation_lambda (float) – Excitation wavelength in nm.

  • indicator (str) – Calcium indicator

  • location (str) – Location of image plane.

  • imaging_rate (float) – Rate images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be stored there instead.

  • manifold (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – DEPRECATED: Physical position of each pixel. size=(“height”, “width”, “xyz”). Deprecated in favor of origin_coords and grid_spacing.

  • conversion (float) – DEPRECATED: Multiplier to get from stored values to specified unit (e.g., 1e-3 for millimeters) Deprecated in favor of origin_coords and grid_spacing.

  • unit (str) – DEPRECATED: Base unit that coordinates are stored in (e.g., Meters). Deprecated in favor of origin_coords_unit and grid_spacing_unit.

  • reference_frame (str) – Describes position and reference frame of manifold based on position of first element in manifold.

  • origin_coords (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma).

  • origin_coords_unit (str) – Measurement units for origin_coords. The default value is ‘meters’.

  • grid_spacing (ndarray or list or tuple or Dataset or StrDataset or HDMFDataset or AbstractDataChunkIterator) – Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid.

  • grid_spacing_unit (str) – Measurement units for grid_spacing. The default value is ‘meters’.

Returns

the ImagingPlane object that was created

Return type

ImagingPlane

create_lab_meta_data(name)

Create a LabMetaData object and add it to this NWBFile

Parameters

name (str) – name of lab metadata

Returns

the LabMetaData object that was created

Return type

LabMetaData

create_ogen_site(name, device, description, excitation_lambda, location)

Create an OptogeneticStimulusSite object and add it to this NWBFile

Parameters
  • name (str) – The name of this stimulus site.

  • device (Device) – The device that was used.

  • description (str) – Description of site.

  • excitation_lambda (float) – Excitation wavelength in nm.

  • location (str) – Location of stimulation site.

Returns

the OptogeneticStimulusSite object that was created

Return type

OptogeneticStimulusSite

create_processing_module(name, description, data_interfaces=None)

Create a ProcessingModule object and add it to this NWBFile

Parameters
  • name (str) – The name of this processing module

  • description (str) – Description of this processing module

  • data_interfaces (list or tuple or dict) – NWBDataInterfaces that belong to this ProcessingModule

Returns

the ProcessingModule object that was created

Return type

ProcessingModule

create_time_intervals(name, description='experimental intervals', id=None, columns=None, colnames=None)

Create a TimeIntervals object and add it to this NWBFile

Parameters
Returns

the TimeIntervals object that was created

Return type

TimeIntervals

property data_collection

Notes about data collection and analysis.

property devices

a dictionary containing the Device in this NWBFile

property electrode_groups

a dictionary containing the ElectrodeGroup in this NWBFile

property electrodes

the ElectrodeTable that belongs to this NWBFile

property epoch_tags

A sorted list of tags used across all epochs

property epochs

Epoch objects belonging to this NWBFile

property experiment_description

general description of the experiment

property experimenter

name of person who performed experiment

property file_create_date

the date and time the file was created and subsequent modifications made

get_acquisition(name=None)

Get a NWBDataInterface from this NWBFile

Parameters

name (str) – the name of the NWBDataInterface or DynamicTable

Returns

the NWBDataInterface or DynamicTable with the given name

Return type

(<class ‘pynwb.core.NWBDataInterface’>, <class ‘hdmf.common.table.DynamicTable’>)

get_analysis(name=None)

Get a NWBContainer from this NWBFile

Parameters

name (str) – the name of the NWBContainer or DynamicTable

Returns

the NWBContainer or DynamicTable with the given name

Return type

(<class ‘pynwb.core.NWBContainer’>, <class ‘hdmf.common.table.DynamicTable’>)

get_device(name=None)

Get a Device from this NWBFile

Parameters

name (str) – the name of the Device

Returns

the Device with the given name

Return type

Device

get_electrode_group(name=None)

Get an ElectrodeGroup from this NWBFile

Parameters

name (str) – the name of the ElectrodeGroup

Returns

the ElectrodeGroup with the given name

Return type

ElectrodeGroup

get_icephys_electrode(name=None)

Get an IntracellularElectrode from this NWBFile

Parameters

name (str) – the name of the IntracellularElectrode

Returns

the IntracellularElectrode with the given name

Return type

IntracellularElectrode

get_imaging_plane(name=None)

Get an ImagingPlane from this NWBFile

Parameters

name (str) – the name of the ImagingPlane

Returns

the ImagingPlane with the given name

Return type

ImagingPlane

get_lab_meta_data(name=None)

Get a LabMetaData from this NWBFile

Parameters

name (str) – the name of the LabMetaData

Returns

the LabMetaData with the given name

Return type

LabMetaData

get_ogen_site(name=None)

Get an OptogeneticStimulusSite from this NWBFile

Parameters

name (str) – the name of the OptogeneticStimulusSite

Returns

the OptogeneticStimulusSite with the given name

Return type

OptogeneticStimulusSite

get_processing_module(name=None)

Get a ProcessingModule from this NWBFile

Parameters

name (str) – the name of the ProcessingModule

Returns

the ProcessingModule with the given name

Return type

ProcessingModule

get_stimulus(name=None)

Get a TimeSeries from this NWBFile

Parameters

name (str) – the name of the TimeSeries

Returns

the TimeSeries with the given name

Return type

TimeSeries

get_stimulus_template(name=None)

Get a TimeSeries from this NWBFile

Parameters

name (str) – the name of the TimeSeries

Returns

the TimeSeries with the given name

Return type

TimeSeries

get_time_intervals(name=None)

Get a TimeIntervals from this NWBFile

Parameters

name (str) – the name of the TimeIntervals

Returns

the TimeIntervals with the given name

Return type

TimeIntervals

property icephys_electrodes

a dictionary containing the IntracellularElectrode in this NWBFile

property icephys_experimental_conditions

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

property icephys_repetitions

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.

property icephys_sequential_recordings

A table for grouping different simultaneous intracellular recording 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.

property icephys_simultaneous_recordings

SimultaneousRecordingsTable table for grouping different intracellular recordings fromthe IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes

property identifier

a unique text identifier for the file

property imaging_planes

a dictionary containing the ImagingPlane in this NWBFile

property institution

institution(s) where experiment is performed

property intervals

a dictionary containing the TimeIntervals in this NWBFile

property intracellular_recordings

IntracellularRecordingsTable table to group together a stimulus and response from a single intracellular electrode and a single simultaneous recording.

property invalid_times

A table containing times to be omitted from analysis

property keywords

Terms to search over

property lab

lab where experiment was performed

property lab_meta_data

a dictionary containing the LabMetaData in this NWBFile

namespace = 'core'
neurodata_type = 'NWBFile'
property notes

Notes about the experiment.

property ogen_sites

a dictionary containing the OptogeneticStimulusSite in this NWBFile

property pharmacology

Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.

property processing

a dictionary containing the ProcessingModule in this NWBFile

property protocol

Experimental protocol, if applicable. E.g., include IACUC protocol

property related_publications

Publication information.PMID, DOI, URL, etc. If multiple, concatenate together and describe which is which. such as PMID, DOI, URL, etc

property scratch

a dictionary containing the DynamicTable, NWBContainer, or ScratchData in this NWBFile

property session_description

a description of the session where this data was generated

property session_id

lab-specific ID for the session

property session_start_time

the start date and time of the recording session

property slices

Description of slices, including information about preparation thickness, orientation, temperature and bath solution

property source_script

Script file used to create this NWB file.

property source_script_file_name

Name of the source_script file

property stimulus

a dictionary containing the TimeSeries in this NWBFile

property stimulus_notes

Notes about stimuli, such as how and where presented.

property stimulus_template

a dictionary containing the TimeSeries in this NWBFile

property subject

subject metadata

property surgery

Narrative description about surgery/surgeries, including date(s) and who performed surgery.

property sweep_table

the SweepTable that belong to this NWBFile

property timestamps_reference_time

date and time corresponding to time zero of all timestamps; defaults to value of session_start_time

property trials

A table containing trial data

property units

A table containing unit metadata

property virus

Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.

pynwb.file.ElectrodeTable(name='electrodes', description='metadata about extracellular electrodes')[source]
pynwb.file.TrialTable(name='trials', description='metadata about experimental trials')[source]
pynwb.file.InvalidTimesTable(name='invalid_times', description='time intervals to be removed from analysis')[source]