pynwb.file module

class pynwb.file.Image

Bases: form.container.Container

class pynwb.file.NWBFile(source, session_description, identifier, session_start_time, file_create_date=None, version=None, experimenter=None, experiment_description=None, session_id=None, institution=None, lab=None, raw_timeseries=None, stimulus=None, stimulus_template=None, epochs=None, modules=None, ec_electrodes=None, ic_electrodes=None, imaging_planes=None, optogenetic_sites=None, devices=None)

Bases: pynwb.core.NWBContainer

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 (list or datetime or str) – the time the file was created and subsequenct modifications made
  • version (str) – the NWB version
  • 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
  • lab (str) – lab where experiment was performed
  • raw_timeseries (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 (list or tuple) – Epoch objects belonging to this NWBFile
  • modules (list or tuple) – ProcessingModule objects belonging to this NWBFile
  • ec_electrodes (list or tuple) – 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
  • optogenetic_sites (list or tuple) – OptogeneticStimulusSites that belong to this NWBFile
  • devices (list or tuple) – Device objects belonging to this NWBFile
add_raw_timeseries(ts, epoch=None)
Parameters:
  • ts (TimeSeries) – the TimeSeries object to add
  • epoch (str or Epoch or list or tuple) – the name of an epoch or an Epoch object or a list of names of epochs or Epoch objects
add_stimulus(ts, epoch=None)
Parameters:
  • ts (TimeSeries) – the TimeSeries object to add
  • epoch (str or Epoch) – the name of an epoch or an Epoch object or a list of names of epochs or Epoch objects
add_stimulus_template(ts, epoch=None)
Parameters:
  • ts (TimeSeries) – the TimeSeries object to add
  • epoch (str or Epoch) – the name of an epoch or an Epoch object or a list of names of epochs or Epoch objects
create_device(name, source)
Parameters:
  • name (str) – the name of this device
  • source (str) – the source of the data
Returns:

the recording device

Return type:

Device

create_electrode_group(name, source, channel_description, channel_location, channel_filtering, channel_coordinates, channel_impedance, description, location, device)

Add an electrode group (e.g. a probe, shank, tetrode).

Parameters:
  • name (str) – the name of this electrode
  • source (str) – the source of the data
  • channel_description (Iterable) – array with description for each channel
  • channel_location (Iterable) – array with location description for each channel e.g. “CA1”
  • channel_filtering (Iterable) – array with description of filtering applied to each channel
  • channel_coordinates (Iterable) – xyz-coordinates for each channel. use NaN for unknown dimensions
  • channel_impedance (Iterable) – float array with impedance used on each channel. Can be 2D matrix to store a range
  • 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 electrode group

Return type:

ElectrodeGroup

create_epoch(name, source, start, stop, tags=[], description=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:
  • name (str) – the name of the epoch, as it will appear in the file
  • source (str) – the source of the data
  • start (float) – the starting time of the epoch
  • stop (float) – the ending time of the epoch
  • tags (tuple or list) – tags for this epoch
  • description (str) – a description of this epoch
create_intracellular_electrode(name, source, slice, seal, description, location, resistance, filtering, initial_access_resistance, device)
Parameters:
  • name (str) – the name of this electrode
  • source (str) – the source of the data
  • slice (str) – Information about slice used for recording.
  • seal (str) – Information about seal used for recording.
  • description (str) – Recording description, description of electrode (e.g., whole-cell, sharp, etc)COMMENT: Free-form text (can be from Methods)
  • 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.
  • device (str) – Name(s) of devices in general/devices.
Returns:

the intracellular electrode

Return type:

IntracellularElectrode

create_processing_module(name, source, description)
Creates a ProcessingModule object of the specified name. NWBContainers can
be created by the module and will be stored inside it
Parameters:
  • name (str) – the name of the processing module
  • source (str) – the source of the data
  • description (str) – description of the processing module
Returns:

a processing module

Return type:

ProcessingModule

description
devices
ec_electrodes
epoch_tags
epochs
experiment_description
experimenter
file_create_date
get_electrode_group(name)
Parameters:name (str) – the name of the electrode group
get_epoch(name)
get_intracellular_electrode(name)

Retrieve an IntracellularElectrode

Parameters:name (str) – the name of the intracellular electrode
get_processing_module(name)

Retrieve a ProcessingModule

Parameters:name (str) – the name of the processing module
get_raw_timeseries(name)

Retrieve acquisition TimeSeries data

Parameters:name (str) – the name of this TimeSeries
get_stimulus(name)

Retrieve stimiulus TimeSeries data

Parameters:name (str) – the name of this TimeSeries
get_stimulus_template(name)

Retrieve stimiulus template TimeSeries data

Parameters:name (str) – the name of this TimeSeries
ic_electrodes
identifier
imaging_planes
institution
is_raw_timeseries(ts)
is_stimulus(ts)
is_stimulus_template(ts)
lab
modules
nwb_version
optogenetic_sites
raw_timeseries
session_description
session_id
session_start_time
set_device(device)
Parameters:device (Device) – the Device object to add to this NWBFile
set_electrode_group(elec_grp)
Parameters:elec_grp (ElectrodeGroup) – the ElectrodeGroup object to add to this NWBFile
set_epoch_timeseries(epoch, timeseries)

Add one or more TimSeries datasets to one or more Epochs

Parameters:
  • epoch (str or Epoch or list or tuple) – the name of an epoch or an Epoch object or a list of names of epochs or Epoch objects
  • timeseries (str or TimeSeries or list or tuple) – the name of a timeseries or a TimeSeries object or a list of names of timeseries or TimeSeries objects
set_intracellular_electrode(ic_elec)
Parameters:ic_elec (IntracellularElectrode) – the IntracellularElectrode object to add to this NWBFile
set_processing_module(module)

Add a ProcessingModule to this NWBFile

Parameters:module (ProcessingModule) – the processing module to add to this file
classmethod set_version(version)
stimulus
stimulus_template
class pynwb.file.SpecFile

Bases: form.container.Container