pynwb package
Subpackages
- pynwb.io package
- Submodules
- Module contents
- pynwb.legacy package
- pynwb.testing package
Submodules
- pynwb.base module
ProcessingModule
ProcessingModule.description
ProcessingModule.data_interfaces
ProcessingModule.containers
ProcessingModule.add_container
ProcessingModule.get_container
ProcessingModule.add_data_interface
ProcessingModule.get_data_interface
ProcessingModule.__getitem__
ProcessingModule.add
ProcessingModule.get
ProcessingModule.namespace
ProcessingModule.neurodata_type
TimeSeries
TimeSeries.DEFAULT_DATA
TimeSeries.DEFAULT_UNIT
TimeSeries.DEFAULT_RESOLUTION
TimeSeries.DEFAULT_CONVERSION
TimeSeries.DEFAULT_OFFSET
TimeSeries.timestamps_unit
TimeSeries.interval
TimeSeries.starting_time
TimeSeries.starting_time_unit
TimeSeries.num_samples
TimeSeries.data
TimeSeries.data_link
TimeSeries.timestamps
TimeSeries.timestamp_link
TimeSeries.time_unit
TimeSeries.get_timestamps
TimeSeries.get_data_in_units
TimeSeries.comments
TimeSeries.continuity
TimeSeries.control
TimeSeries.control_description
TimeSeries.conversion
TimeSeries.description
TimeSeries.namespace
TimeSeries.neurodata_type
TimeSeries.offset
TimeSeries.rate
TimeSeries.resolution
TimeSeries.unit
Image
ImageReferences
Images
TimeSeriesReference
TimeSeriesReferenceVectorData
TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_TUPLE
TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_NONE_TYPE
TimeSeriesReferenceVectorData.namespace
TimeSeriesReferenceVectorData.neurodata_type
TimeSeriesReferenceVectorData.add_row
TimeSeriesReferenceVectorData.append
TimeSeriesReferenceVectorData.get
- pynwb.behavior module
- pynwb.core module
- pynwb.device module
- pynwb.ecephys module
- pynwb.epoch module
- pynwb.file module
LabMetaData
Subject
NWBFile
NWBFile.all_children
NWBFile.objects
NWBFile.modules
NWBFile.epoch_tags
NWBFile.ec_electrode_groups
NWBFile.ec_electrodes
NWBFile.ic_electrodes
NWBFile.icephys_filtering
NWBFile.add_ic_electrode
NWBFile.create_ic_electrode
NWBFile.get_ic_electrode
NWBFile.add_epoch_column
NWBFile.add_epoch_metadata_column
NWBFile.add_epoch
NWBFile.add_electrode_column
NWBFile.add_electrode
NWBFile.create_electrode_table_region
NWBFile.add_unit_column
NWBFile.add_unit
NWBFile.add_trial_column
NWBFile.add_trial
NWBFile.add_invalid_times_column
NWBFile.add_invalid_time_interval
NWBFile.set_electrode_table
NWBFile.add_acquisition
NWBFile.add_stimulus
NWBFile.add_stimulus_template
NWBFile.get_intracellular_recordings
NWBFile.add_intracellular_recording
NWBFile.get_icephys_simultaneous_recordings
NWBFile.add_icephys_simultaneous_recording
NWBFile.get_icephys_sequential_recordings
NWBFile.add_icephys_sequential_recording
NWBFile.get_icephys_repetitions
NWBFile.add_icephys_repetition
NWBFile.get_icephys_experimental_conditions
NWBFile.add_icephys_experimental_condition
NWBFile.get_icephys_meta_parent_table
NWBFile.add_scratch
NWBFile.get_scratch
NWBFile.copy
NWBFile.acquisition
NWBFile.add_analysis
NWBFile.add_device
NWBFile.add_electrode_group
NWBFile.add_icephys_electrode
NWBFile.add_imaging_plane
NWBFile.add_lab_meta_data
NWBFile.add_ogen_site
NWBFile.add_processing_module
NWBFile.add_time_intervals
NWBFile.analysis
NWBFile.create_device
NWBFile.create_electrode_group
NWBFile.create_icephys_electrode
NWBFile.create_imaging_plane
NWBFile.create_lab_meta_data
NWBFile.create_ogen_site
NWBFile.create_processing_module
NWBFile.create_time_intervals
NWBFile.data_collection
NWBFile.devices
NWBFile.electrode_groups
NWBFile.electrodes
NWBFile.epochs
NWBFile.experiment_description
NWBFile.experimenter
NWBFile.file_create_date
NWBFile.get_acquisition
NWBFile.get_analysis
NWBFile.get_device
NWBFile.get_electrode_group
NWBFile.get_icephys_electrode
NWBFile.get_imaging_plane
NWBFile.get_lab_meta_data
NWBFile.get_ogen_site
NWBFile.get_processing_module
NWBFile.get_stimulus
NWBFile.get_stimulus_template
NWBFile.get_time_intervals
NWBFile.icephys_electrodes
NWBFile.icephys_experimental_conditions
NWBFile.icephys_repetitions
NWBFile.icephys_sequential_recordings
NWBFile.icephys_simultaneous_recordings
NWBFile.identifier
NWBFile.imaging_planes
NWBFile.institution
NWBFile.intervals
NWBFile.intracellular_recordings
NWBFile.invalid_times
NWBFile.keywords
NWBFile.lab
NWBFile.lab_meta_data
NWBFile.namespace
NWBFile.neurodata_type
NWBFile.notes
NWBFile.ogen_sites
NWBFile.pharmacology
NWBFile.processing
NWBFile.protocol
NWBFile.related_publications
NWBFile.scratch
NWBFile.session_description
NWBFile.session_id
NWBFile.session_start_time
NWBFile.slices
NWBFile.source_script
NWBFile.source_script_file_name
NWBFile.stimulus
NWBFile.stimulus_notes
NWBFile.stimulus_template
NWBFile.subject
NWBFile.surgery
NWBFile.sweep_table
NWBFile.timestamps_reference_time
NWBFile.trials
NWBFile.units
NWBFile.virus
ElectrodeTable
TrialTable
InvalidTimesTable
- pynwb.icephys module
ensure_unit
IntracellularElectrode
IntracellularElectrode.cell_id
IntracellularElectrode.description
IntracellularElectrode.device
IntracellularElectrode.filtering
IntracellularElectrode.initial_access_resistance
IntracellularElectrode.location
IntracellularElectrode.namespace
IntracellularElectrode.neurodata_type
IntracellularElectrode.resistance
IntracellularElectrode.seal
IntracellularElectrode.slice
PatchClampSeries
CurrentClampSeries
IZeroClampSeries
CurrentClampStimulusSeries
VoltageClampSeries
VoltageClampSeries.capacitance_fast
VoltageClampSeries.capacitance_slow
VoltageClampSeries.resistance_comp_bandwidth
VoltageClampSeries.resistance_comp_correction
VoltageClampSeries.resistance_comp_prediction
VoltageClampSeries.whole_cell_capacitance_comp
VoltageClampSeries.whole_cell_series_resistance_comp
VoltageClampSeries.namespace
VoltageClampSeries.neurodata_type
VoltageClampStimulusSeries
SweepTable
IntracellularElectrodesTable
IntracellularStimuliTable
IntracellularResponsesTable
IntracellularRecordingsTable
SimultaneousRecordingsTable
SequentialRecordingsTable
RepetitionsTable
ExperimentalConditionsTable
- pynwb.image module
- pynwb.misc module
- pynwb.ogen module
- pynwb.ophys module
OpticalChannel
ImagingPlane
ImagingPlane.conversion
ImagingPlane.description
ImagingPlane.device
ImagingPlane.excitation_lambda
ImagingPlane.grid_spacing
ImagingPlane.grid_spacing_unit
ImagingPlane.imaging_rate
ImagingPlane.indicator
ImagingPlane.location
ImagingPlane.manifold
ImagingPlane.namespace
ImagingPlane.neurodata_type
ImagingPlane.optical_channel
ImagingPlane.origin_coords
ImagingPlane.origin_coords_unit
ImagingPlane.reference_frame
ImagingPlane.unit
OnePhotonSeries
TwoPhotonSeries
CorrectedImageStack
MotionCorrection
PlaneSegmentation
ImageSegmentation
RoiResponseSeries
DfOverF
Fluorescence
- pynwb.resources module
- pynwb.spec module
- pynwb.validate module
Module contents
This package will contain functions, classes, and objects for reading and writing data in NWB format
- pynwb.load_type_config(config_path, type_map=None)[source]
This method will either load the default config or the config provided by the path.
- pynwb.unload_type_config(type_map=None)[source]
Remove validation.
- Parameters:
type_map (
TypeMap
) – The TypeMap.
- pynwb.get_type_map(extensions=None)[source]
- Get the TypeMap for the given extensions. If no extensions are provided,
return the TypeMap for the core namespace
- pynwb.get_manager(extensions=None)[source]
- Get a BuildManager to use for I/O using the given extensions. If no extensions are provided,
return a BuildManager that uses the core namespace
- pynwb.register_class(neurodata_type, namespace, container_cls=None)[source]
- Register an NWBContainer class to use for reading and writing a neurodata_type from a specification
If container_cls is not specified, returns a decorator for registering an NWBContainer subclass as the class for neurodata_type in namespace.
- pynwb.get_nwbfile_version(h5py_file)[source]
Get the NWB version of the file if it is an NWB file.
- Returns:
Tuple consisting of: 1) the original version string as stored in the file and 2) a tuple with the parsed components of the version string, consisting of integers and strings, e.g., (2, 5, 1, beta). (None, None) will be returned if the file is not a valid NWB file or the nwb_version is missing, e.g., in the case when no data has been written to the file yet.
- Parameters:
h5py_file (
File
) – An NWB file
- pynwb.register_map(container_cls, mapper_cls=None)[source]
- Register an ObjectMapper to use for a Container class type
If mapper_cls is not specified, returns a decorator for registering an ObjectMapper class as the mapper for container_cls. If mapper_cls is specified, register the class as the mapper for container_cls
- pynwb.get_class(neurodata_type, namespace)[source]
- Parse the YAML file for a given neurodata_type that is a subclass of NWBContainer and automatically generate its
python API. This will work for most containers, but is known to not work for descendants of MultiContainerInterface and DynamicTable, so these must be defined manually (for now). get_class infers the API mapping directly from the specification. If you want to define a custom mapping, you should not use this function and you should define the class manually.
Examples:
Generating and registering an extension is as simple as:
MyClass = get_class('MyClass', 'ndx-my-extension')
get_class defines only the __init__ for the class. In cases where you want to provide additional methods for querying, plotting, etc. you can still use get_class and attach methods to the class after-the-fact, e.g.:
def get_sum(self, a, b): return self.feat1 + self.feat2 MyClass.get_sum = get_sum
- class pynwb.NWBHDF5IO(path=None, mode='r', load_namespaces=True, manager=None, extensions=None, file=None, comm=None, driver=None, aws_region=None, herd_path=None)[source]
Bases:
HDF5IO
- Parameters:
mode (
str
) – the mode to open the HDF5 file with, one of (“w”, “r”, “r+”, “a”, “w-”, “x”)load_namespaces (
bool
) – whether or not to load cached namespaces from given path - not applicable in write mode or when manager is not None or when extensions is not Nonemanager (
BuildManager
) – the BuildManager to use for I/Oextensions (
str
orTypeMap
orlist
) – a path to a namespace, a TypeMap, or a list consisting paths to namespaces and TypeMapsfile (
File
orS3File
orRemFile
) – a pre-existing h5py.File, S3File, or RemFile objectcomm (
Intracomm
) – the MPI communicator to use for parallel I/Odriver (
str
) – driver for h5py to use when opening HDF5 fileaws_region (
str
) – If driver is ros3, then specify the aws region of the url.herd_path (
str
) – The path to read/write the HERD file
- property nwb_version
Get the version of the NWB file opened via this NWBHDF5IO object.
- Returns:
Tuple consisting of: 1) the original version string as stored in the file and 2) a tuple with the parsed components of the version string, consisting of integers and strings, e.g., (2, 5, 1, beta). (None, None) will be returned if the nwb_version is missing, e.g., in the case when no data has been written to the file yet.
- read(skip_version_check=False)[source]
Read the NWB file from the IO source.
- raises TypeError:
If the NWB file version is missing or not supported
- return:
NWBFile container
- Parameters:
skip_version_check (
bool
) – skip checking of NWB version
- export(src_io, nwbfile=None, write_args=None, cache_spec=True)[source]
Export an NWB file to a new NWB file using the HDF5 backend.
If
nwbfile
is provided, then the build manager ofsrc_io
is used to build the container, and the resulting builder will be exported to the new backend. So ifnwbfile
is provided,src_io
must have a non-None manager property. Ifnwbfile
is None, then the contents ofsrc_io
will be read and exported to the new backend.Arguments can be passed in for the
write_builder
method usingwrite_args
. Some arguments may not be supported during export.{'link_data': False}
can be used to copy any datasets linked to from the original file instead of creating a new link to those datasets in the exported file.The exported file will not contain any links to the original file. All links, internal and external, will be preserved in the exported file. All references will also be preserved in the exported file.
The exported file will use the latest schema version supported by the version of PyNWB used. For example, if the input file uses the NWB schema version 2.1 and the latest schema version supported by PyNWB is 2.3, then the exported file will use the 2.3 NWB schema.
Example usage:
with NWBHDF5IO(self.read_path, mode='r') as read_io: nwbfile = read_io.read() # ... # modify nwbfile nwbfile.set_modified() # this may be necessary if the modifications are changes to attributes with NWBHDF5IO(self.export_path, mode='w') as export_io: export_io.export(src_io=read_io, nwbfile=nwbfile)
See Exporting NWB files and Adding/Removing Containers from an NWB File for more information and examples.
- Parameters:
src_io (
HDMFIO
) – the HDMFIO object (such as NWBHDF5IO) that was used to read the data to exportnwbfile (
NWBFile
) – the NWBFile object to export. If None, then the entire contents of src_io will be exportedwrite_args (
dict
) – arguments to pass towrite_builder
cache_spec (
bool
) – whether to cache the specification to file