NwbFile

class NwbFile(propValues)[source]

Bases: types.core.NWBFile

NWBFILE - Root object representing an NWB file.

Requires that core and extension NWB types have been generated and reside in a +types namespace on the MATLAB search path.

Usage:

Example 1 - Construct a simple NwbFile object for export:

nwb = NwbFile;
nwb.epochs = types.core.Epochs;
nwbExport(nwb, 'epoch.nwb');
See also:

nwbRead(), generateCore(), generateExtension()

Constructor Summary
NwbFile(propValues)

NWBFILE - Create an NWB File object

Method Summary
addRef(container, options)

addRef() - Record that an object in this file refers to an external entity.

Syntax:

nwb.addRef(container, EntityId=entityId, EntityUri=entityUri) records that container refers to the external entity identified by entityId, creating this file’s HERD (see getExternalResources) if it does not have one yet.

nwb.addRef(__, Attribute=attribute) attaches the reference to a neurodata object held by container rather than to container itself, for example a column of a DynamicTable.

Input Arguments:
  • container - The neurodata object the reference is attached to, for example a types.core.Subject or a column of a table. Must already be part of this file.

Name-Value Arguments:
  • EntityId (string) - Identifier of the entity in the external resource, given as a compact URI (CURIE) of the form prefix:identifier, for example “NCBITaxon:10090”.

  • EntityUri (string) - The URL that EntityId resolves to. Required the first time an entity is added; ignored afterwards, since the stored URI is kept.

  • Key (string) - The term as it is used in the file, for example “Mus musculus”.

  • Attribute (string) - Name of a property of container holding the neurodata object the reference belongs to. Only properties that are themselves neurodata types are supported, such as a column of a table.

  • Field (string) - Field of a compound data type the reference applies to. Leave unset unless the target is a compound dataset.

Usage:

Example 1 - Annotate a subject’s species:

nwb.addRef(nwb.general_subject, Key=nwb.general_subject.species, ...
    EntityId="NCBITaxon:10090", ...
    EntityUri="http://purl.obolibrary.org/obo/NCBITaxon_10090")
See also:

NwbFile.getExternalResources types.hdmf_common.HERD

applyDatasetSettings(settingsReference, options)

APPLYDATASETSETTINGS - Configure datasets using NWB dataset settings

Syntax:

nwb.applyDatasetSettings(settingsReference) applies a dataset configuration profile to the nwb-file nwb. This method accepts the filename of a custom configuration profile or a structure representing a configuration profile.

Input Arguments:
  • obj (NwbFile) - An instance of the NwbFile class.

  • settingsReference (string | struct) - The filename of a custom configuration profile or an in-memory structure representing a configuration profile.

Name-Value Arguments:
  • OverrideExisting (logical) - This boolean determines if existing DataPipe objects in the file will be reconfigured with the provided options. Default is false. Important: This does not work for DataPipes that has previously been exported to file.

Output Arguments:
  • datasetConfig - (Optional) The configuration settings applied to the dataset.

See also:

io.config.enum.ConfigurationProfile NwbFile.applyDatasetSettingsProfile()

applyDatasetSettingsProfile(profile, options)

APPLYDATASETSETTINGSPROFILE - Configure datasets using predefined settings profile

Syntax:

nwb.applyDatasetSettingsProfile(profile) applies a dataset configuration profile to the nwb-file nwb. Available profiles: “default”, “cloud”, “archive”. This will configure datasets in the NwbFile object for chunking and compression.

Input Arguments:
  • obj (NwbFile) - An instance of the NwbFile class.

  • profile (ConfigurationProfile) - Specifies the settings profile to use. Default is “none”.

Name-Value Arguments:
  • OverrideExisting (logical) - This boolean determines if existing DataPipe objects in the file will be reconfigured with the provided options. Default is false. Important: This does not work for DataPipes that has previously been exported to file.

Output Arguments:
  • datasetConfig - (Optional) The configuration settings applied to the dataset.

See also:

io.config.enum.ConfigurationProfile NwbFile.applyDatasetSettings()

export(filename, mode, options)

EXPORT - Export NWB file object

getExternalResources()

getExternalResources() - Get this file’s HERD, creating one if needed.

Syntax:

herd = nwb.getExternalResources() returns the file’s HERD (HDMF External Resources Data Structure), which records that terms used in the file correspond to entities in an external resource such as an ontology. A file has at most one HERD, so this returns the existing one if the file already has one, for example after nwbRead(), and attaches a new empty one otherwise. The HERD it returns can be exported as it is, so a file whose external resources hold no references still writes them.

Output Arguments:
See also:

NwbFile.addRef types.hdmf_common.HERD

getTypeObjects(typeName, options)

GETTYPEOBJECTS - Retrieve NWB objects of a specified type.

Syntax:
nwbObjects = GETTYPEOBJECTS(obj, typeName) Retrieves NWB

objects of the specified type from the NwbFile object.

nwbObjects = GETTYPEOBJECTS(obj, typeName, Name, Value) Retrieves NWB objects of the specified type from the NwbFile object using provided name-value pairs controlling options.

Input Arguments:
  • obj (NwbFile) - The NwbFile object from which to retrieve NWB objects.

  • typeName (1,1) string - The name of the type to search for. Can include namespace, but does not have to, i.e types.core.TimeSeries and TimeSeries are supported.

  • options (name-value pairs) - Optional name-value pairs. Available options:

    • IncludeSubTypes logical - Optional: set to true to include subclasses in the search. Default is false.

Output Arguments:
  • nwbObjects (cell) - A cell array of NWB objects of the specified type.

Usage:

Example 1 - Get all ElectricalSeries objects from NwbFile:

evalc('run("ecephys.mlx")');
nwb.getTypeObjects('ElectricalSeries')

Example 2 - Get all ElectricalSeries and subtype objects from NwbFile:

evalc('run("ecephys.mlx")')
nwb.getTypeObjects('ElectricalSeries', 'IncludeSubTypes', true)
listNwbTypes(options)

listNwbTypes() - List all unique NWB (neurodata) types in file

listRemappedNames()
resolve(path)
searchFor(typename, varargin)

searchFor() - Search for for a given typename within the NwbFile object

Including the full namespace is optional.

Warning

The returned paths are resolvable but do not necessarily indicate a real HDF5 path. Their only function is to be resolvable.