pynwb.file module

class pynwb.file.Image(name, data, parent=None, container_source=None)

Bases: pynwb.core.NWBData

Parameters:
  • name (str) – the name of this container
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or Data) – the source of the data
  • parent (NWBContainer) – the parent Container for this Container
  • container_source (object) – the source of this Container e.g. file name
class pynwb.file.SpecFile(name, parent=None, container_source=None)

Bases: pynwb.form.container.Container

Parameters:
  • name (str) – the name of this container
  • parent (Container) – the Container that holds this Container
  • container_source (str) – the source of this container
namespace = 'core'
neurodata_type = 'SpecFile'
class pynwb.file.Subject(age=None, description=None, genotype=None, sex=None, species=None, subject_id=None, weight=None, source=None)

Bases: pynwb.core.NWBContainer

Parameters:
  • age (str) – the age of the subject
  • description (str) – a description of the subject
  • genotype (str) – the genotype of the subject
  • sex (str) – the sex of the subject
  • species (str) – the species of the subject
  • subject_id (str) – a unique identifier for the subject
  • weight (str) – the weight of the subject
  • source (str) – the source of this information
age

the age of the subject

description

a description of the subject

genotype

the genotype of the subject

sex

the sex of the subject

species

the species of the subject

subject_id

a unique identifier for the subject

weight

the weight of the subject

namespace = 'core'
neurodata_type = 'Subject'
class pynwb.file.NWBFile(source, session_description, identifier, session_start_time, file_create_date=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, stimulus=None, stimulus_template=None, epochs=None, epoch_tags=set(), trials=None, units=None, modules=None, ec_electrodes=None, ec_electrode_groups=None, ic_electrodes=None, imaging_planes=None, ogen_sites=None, devices=None, subject=None)

Bases: pynwb.core.MultiContainerInterface

A representation of an NWB file.

Parameters:
  • source (str) – the source of the data
  • 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 or str) – the start time of the recording session
  • file_create_date (ndarray or list or tuple or Dataset or AbstractDataChunkIterator or DataIO or FORMDataset or datetime or str) – the time the file was created and subsequent modifications made
  • experimenter (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 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 (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 sourc_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
  • 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 (Epochs) – Epoch objects belonging to this NWBFile
  • epoch_tags (tuple or list or set) – A sorted list of tags used across all epochs
  • trials (DynamicTable) – A table containing trial data
  • units (DynamicTable) – A table containing unit metadata
  • modules (list or tuple) – ProcessingModule objects belonging to this NWBFile
  • ec_electrodes (ElectrodeTable or Iterable) – the ElectrodeTable that belongs to this NWBFile
  • ec_electrode_groups (Iterable) – the ElectrodeGroups that belong to this NWBFile
  • ic_electrodes (list or tuple) – IntracellularElectrodes 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
acquisition

a dictionary containing the NWBDataInterface in this NWBFile container

stimulus

a dictionary containing the TimeSeries in this NWBFile container

stimulus_template

a dictionary containing the TimeSeries in this NWBFile container

keywords

Terms to search over

modules

a dictionary containing the ProcessingModule in this NWBFile container

epochs

Epoch objects belonging to this NWBFile

epoch_tags

A sorted list of tags used across all epochs

trials

A table containing trial data

units

A table containing unit metadata

ec_electrodes

the ElectrodeTable that belongs to this NWBFile

ec_electrode_groups

a dictionary containing the ElectrodeGroup in this NWBFile container

devices

a dictionary containing the Device in this NWBFile container

ic_electrodes

a dictionary containing the IntracellularElectrode in this NWBFile container

imaging_planes

a dictionary containing the ImagingPlane in this NWBFile container

ogen_sites

a dictionary containing the OptogeneticStimulusSite in this NWBFile container

subject

subject metadata

all_children()
identifier
session_description
file_create_date
session_start_time
add_electrode(id, x, y, z, imp, location, filtering, description, group, group_name=None)
Parameters:
  • id (int) – a unique identifier for the electrode
  • x (float) – the x coordinate of the position
  • y (float) – the y coordinate of the position
  • z (float) – the z coordinate of the position
  • imp (float) – the impedance of the electrode
  • location (str) – the location of electrode within the subject e.g. brain region
  • filtering (str) – description of hardware filtering
  • description (str) – a brief description of what this electrode is
  • group (ElectrodeGroup) – the ElectrodeGroup object to add to this NWBFile
  • group_name (str) – the ElectrodeGroup object to add to this NWBFile
create_electrode_table_region(region, description, name='electrodes')
Parameters:
  • region (slice or list or tuple or RegionReference) – the indices of the table
  • description (str) – a brief description of what this electrode is
  • name (str) – the name of this container
create_epoch(description, start_time, stop_time, tags, timeseries, metadata=None)
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:
  • description (str) – a description of this epoch
  • 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 uesd throughout epochs
  • timeseries (list or tuple or TimeSeries) – the TimeSeries this epoch applies to
  • metadata (dict) – the metadata about this epoch
add_acquisition(acquisition)

Add a NWBDataInterface to this NWBFile

Parameters:acquisition (list or tuple or dict or NWBDataInterface) – the NWBDataInterface to add
add_analysis(analysis)

Add a NWBContainer to this NWBFile

Parameters:analysis (list or tuple or dict or NWBContainer) – the NWBContainer to add
add_device(devices)

Add a Device to this NWBFile

Parameters:devices (list or tuple or dict or Device) – the Device to add
add_electrode_group(ec_electrode_groups)

Add an ElectrodeGroup to this NWBFile

Parameters:ec_electrode_groups (list or tuple or dict or ElectrodeGroup) – the ElectrodeGroup to add
add_ic_electrode(ic_electrodes)

Add an IntracellularElectrode to this NWBFile

Parameters:ic_electrodes (list or tuple or dict or IntracellularElectrode) – the IntracellularElectrode to add
add_imaging_plane(imaging_planes)

Add an ImagingPlane to this NWBFile

Parameters:imaging_planes (list or tuple or dict or ImagingPlane) – the ImagingPlane to add
add_ogen_site(ogen_sites)

Add an OptogeneticStimulusSite to this NWBFile

Parameters:ogen_sites (list or tuple or dict or OptogeneticStimulusSite) – the OptogeneticStimulusSite to add
add_processing_module(modules)

Add a ProcessingModule to this NWBFile

Parameters:modules (list or tuple or dict or ProcessingModule) – the ProcessingModule to add
add_stimulus(stimulus)

Add a TimeSeries to this NWBFile

Parameters:stimulus (list or tuple or dict or TimeSeries) – the TimeSeries to add
add_stimulus_template(stimulus_template)

Add a TimeSeries to this NWBFile

Parameters:stimulus_template (list or tuple or dict or TimeSeries) – the TimeSeries to add
analysis

a dictionary containing the NWBContainer in this NWBFile container

create_device(name, source)

Create a Device and add it to this NWBFile

Parameters:
  • name (str) – the name of this device
  • source (str) – the source of the data
Returns:

the Device object that was created

Return type:

Device

create_electrode_group(name, source, description, location, device)

Create an ElectrodeGroup and add it to this NWBFile

Parameters:
  • name (str) – the name of this electrode
  • source (str) – the source of the data
  • 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
Returns:

the ElectrodeGroup object that was created

Return type:

ElectrodeGroup

create_ic_electrode(name, device, source, description, slice=None, seal=None, location=None, resistance=None, filtering=None, initial_access_resistance=None)

Create an IntracellularElectrode 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
  • source (str) – the source of the data
  • description (str) – Recording description, description of electrode (e.g., whole-cell, sharp, etc) COMMENT: Free-form text (can be from Methods)
  • 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 COMMENT: unit: Ohm.
  • filtering (str) – Electrode specific filtering.
  • initial_access_resistance (str) – Initial access resistance.
Returns:

the IntracellularElectrode object that was created

Return type:

IntracellularElectrode

create_imaging_plane(name, source, optical_channel, description, device, excitation_lambda, imaging_rate, indicator, location, manifold=None, conversion=None, unit=None, reference_frame=None)

Create an ImagingPlane and add it to this NWBFile

Parameters:
  • name (str) – the name of this electrode
  • source (str) – the source of the data
  • optical_channel (list or OpticalChannel) – One of possibly many groups storing channelspecific data.
  • description (str) – Description of this ImagingPlane.
  • device (Device) – the device that was used to record
  • excitation_lambda (float) – Excitation wavelength.
  • imaging_rate (str) – Rate images are acquired, in Hz.
  • indicator (str) – Calcium indicator
  • location (str) – Location of image plane.
  • manifold (Iterable) – Physical position of each pixel. size=(“height”, “width”, “xyz”).
  • conversion (float) – Multiplier to get from stored values to specified unit (e.g., 1e-3 for millimeters)
  • unit (str) – Base unit that coordinates are stored in (e.g., Meters).
  • reference_frame (str) – Describes position and reference frame of manifold based on position of first element in manifold.
Returns:

the ImagingPlane object that was created

Return type:

ImagingPlane

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

Create an OptogeneticStimulusSite and add it to this NWBFile

Parameters:
  • name (str) – The name of this stimulus site
  • source (str) – the source of the data
  • device (Device) – the device that was used
  • description (str) – Description of site.
  • excitation_lambda (str) – Excitation wavelength.
  • location (str) – Location of stimulation site.
Returns:

the OptogeneticStimulusSite object that was created

Return type:

OptogeneticStimulusSite

create_processing_module(name, source, description, data_interfaces=None)

Create a ProcessingModule and add it to this NWBFile

Parameters:
  • name (str) – The name of this processing module
  • source (str) – the source of the data
  • description (str) – Description of this processing module
  • data_interfaces (list or tuple or dict) – NWBDataInterfacess that belong to this ProcessingModule
Returns:

the ProcessingModule object that was created

Return type:

ProcessingModule

data_collection

Notes about data collection and analysis.

description
experiment_description

general description of the experiment

experimenter

name of person who performed experiment

get_acquisition(name=None)

Get a NWBDataInterface from this NWBFile

Parameters:name (str) – the name of the NWBDataInterface
Returns:the NWBDataInterface with the given name
Return type:NWBDataInterface
get_analysis(name=None)

Get a NWBContainer from this NWBFile

Parameters:name (str) – the name of the NWBContainer
Returns:the NWBContainer with the given name
Return type:NWBContainer
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_ic_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_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
institution

institution(s) where experiment is performed

lab

lab where experiment was performed

namespace = 'core'
neurodata_type = 'NWBFile'
notes

Notes about the experiment.

pharmacology

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

protocol

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

related_publications

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

session_id

lab-specific ID for the session

slices

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

source_script

Script file used to create this NWB file.

source_script_file_name

Name of the sourc_script file

stimulus_notes

Notes about stimuli, such as how and where presented.

surgery

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

virus

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

add_unit_column(name, description, data=[])
Add a column to the unit table.
See add_column for more details
Parameters:
  • name (str) – the name of this column
  • description (str) – a description for this column
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator) – the data contained in this column
add_unit(data, id=None)
Add a unit to the unit table.

See add_row for more details.

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

Parameters:
  • data (dict) – None
  • id (int) – None
add_trial_column(name, description, data=[])
Add a column to the trial table.
See add_column for more details
Parameters:
  • name (str) – the name of this column
  • description (str) – a description for this column
  • data (ndarray or list or tuple or Dataset or AbstractDataChunkIterator) – the data contained in this column
add_trial(data, id=None)
Add a trial to the trial table.

See add_row for more details.

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

Parameters:
  • data (dict) – None
  • id (int) – None
set_electrode_table(electrode_table)

Set the electrode table of this NWBFile to an existing ElectrodeTable

Parameters:electrode_table (ElectrodeTable) – the ElectrodeTable for this file