pynwb.spec module

class pynwb.spec.NWBRefSpec(target_type, reftype)[source]

Bases: hdmf.spec.spec.RefSpec

Parameters:
  • target_type (str) – the target type GroupSpec or DatasetSpec
  • reftype (str) – the type of references this is i.e. region or object
class pynwb.spec.NWBAttributeSpec(name, doc, dtype, shape=None, dims=None, required=True, parent=None, value=None, default_value=None)[source]

Bases: hdmf.spec.spec.AttributeSpec

Parameters:
  • name (str) – The name of this attribute
  • doc (str) – a description about what this specification represents
  • dtype (str or RefSpec) – The data type of this attribute
  • shape (list or tuple) – the shape of this dataset
  • dims (list or tuple) – the dimensions of this dataset
  • required (bool) – whether or not this attribute is required. ignored when “value” is specified
  • parent (BaseStorageSpec) – the parent of this spec
  • value (None) – a constant value for this attribute
  • default_value (None) – a default value for this attribute
class pynwb.spec.NWBLinkSpec(doc, target_type, quantity=1, name=None)[source]

Bases: hdmf.spec.spec.LinkSpec

Parameters:
  • doc (str) – a description about what this link represents
  • target_type (str) – the target type GroupSpec or DatasetSpec
  • quantity (str or int) – the required number of allowed instance
  • name (str) – the name of this link
neurodata_type_inc

The neurodata type of target specification

class pynwb.spec.BaseStorageOverride[source]

Bases: object

This class is used for the purpose of overriding BaseStorageSpec classmethods, without creating diamond inheritance hierarchies.

classmethod type_key()[source]

Get the key used to store data type on an instance

classmethod inc_key()[source]

Get the key used to define a data_type include.

classmethod def_key()[source]

Get the key used to define a data_type definition.

neurodata_type_inc
neurodata_type_def
classmethod build_const_args(spec_dict)[source]

Extend base functionality to remap data_type_def and data_type_inc keys

class pynwb.spec.NWBDtypeSpec(name, doc, dtype)[source]

Bases: hdmf.spec.spec.DtypeSpec

Parameters:
  • name (str) – the name of this column
  • doc (str) – a description about what this data type is
  • dtype (str or list or RefSpec) – the data type of this column
class pynwb.spec.NWBDatasetSpec(doc, dtype=None, name=None, default_name=None, shape=None, dims=None, attributes=[], linkable=True, quantity=1, default_value=None, neurodata_type_def=None, neurodata_type_inc=None)[source]

Bases: pynwb.spec.BaseStorageOverride, hdmf.spec.spec.DatasetSpec

The Spec class to use for NWB specifications

Parameters:
  • doc (str) – a description about what this specification represents
  • dtype (str or list or RefSpec) – The data type of this attribute. Use a list of DtypeSpecs to specify a compound data type.
  • name (str) – The name of this dataset
  • default_name (str) – The default name of this dataset
  • shape (list or tuple) – the shape of this dataset
  • dims (list or tuple) – the dimensions of this dataset
  • attributes (list) – the attributes on this group
  • linkable (bool) – whether or not this group can be linked
  • quantity (str or int) – the required number of allowed instance
  • default_value (None) – a default value for this dataset
  • neurodata_type_def (str) – the NWB data type this spec defines
  • neurodata_type_inc (NWBDatasetSpec or str) – the NWB data type this spec includes
class pynwb.spec.NWBGroupSpec(doc, name=None, default_name=None, groups=[], datasets=[], attributes=[], links=[], linkable=True, quantity=1, neurodata_type_def=None, neurodata_type_inc=None)[source]

Bases: pynwb.spec.BaseStorageOverride, hdmf.spec.spec.GroupSpec

The Spec class to use for NWB specifications

Parameters:
  • doc (str) – a description about what this specification represents
  • name (str) – the name of this group
  • default_name (str) – The default name of this group
  • groups (list) – the subgroups in this group
  • datasets (list) – the datasets in this group
  • attributes (list) – the attributes on this group
  • links (list) – the links in this group
  • linkable (bool) – whether or not this group can be linked
  • quantity (str or int) – the required number of allowed instance
  • neurodata_type_def (str) – the NWB data type this spec defines
  • neurodata_type_inc (NWBGroupSpec or str) – the NWB data type this spec includes
classmethod dataset_spec_cls()[source]

The class to use when constructing DatasetSpec objects

Override this if extending to use a class other than DatasetSpec to build dataset specifications

get_neurodata_type(neurodata_type)[source]

Get a specification by “data_type”

Parameters:neurodata_type (str) – the neurodata_type to retrieve
add_group(doc, name=None, default_name=None, groups=[], datasets=[], attributes=[], links=[], linkable=True, quantity=1, neurodata_type_def=None, neurodata_type_inc=None)[source]

Add a new specification for a subgroup to this group specification

Parameters:
  • doc (str) – a description about what this specification represents
  • name (str) – the name of this group
  • default_name (str) – The default name of this group
  • groups (list) – the subgroups in this group
  • datasets (list) – the datasets in this group
  • attributes (list) – the attributes on this group
  • links (list) – the links in this group
  • linkable (bool) – whether or not this group can be linked
  • quantity (str or int) – the required number of allowed instance
  • neurodata_type_def (str) – the NWB data type this spec defines
  • neurodata_type_inc (NWBGroupSpec or str) – the NWB data type this spec includes
add_dataset(doc, dtype=None, name=None, default_name=None, shape=None, dims=None, attributes=[], linkable=True, quantity=1, default_value=None, neurodata_type_def=None, neurodata_type_inc=None)[source]

Add a new specification for a subgroup to this group specification

Parameters:
  • doc (str) – a description about what this specification represents
  • dtype (str or list or RefSpec) – The data type of this attribute. Use a list of DtypeSpecs to specify a compound data type.
  • name (str) – The name of this dataset
  • default_name (str) – The default name of this dataset
  • shape (list or tuple) – the shape of this dataset
  • dims (list or tuple) – the dimensions of this dataset
  • attributes (list) – the attributes on this group
  • linkable (bool) – whether or not this group can be linked
  • quantity (str or int) – the required number of allowed instance
  • default_value (None) – a default value for this dataset
  • neurodata_type_def (str) – the NWB data type this spec defines
  • neurodata_type_inc (NWBDatasetSpec or str) – the NWB data type this spec includes
class pynwb.spec.NWBNamespace(doc, name, schema, full_name=None, version=None, date=None, author=None, contact=None, catalog=None)[source]

Bases: hdmf.spec.namespace.SpecNamespace

A Namespace class for NWB

Parameters:
  • doc (str) – a description about what this namespace represents
  • name (str) – the name of this namespace
  • schema (list) – location of schema specification files or other Namespaces
  • full_name (str) – extended full name of this namespace
  • version (str or tuple or list) – Version number of the namespace
  • date (datetime or str) – Date last modified or released. Formatting is %Y-%m-%d %H:%M:%S, e.g, 2017-04-25 17:14:13
  • author (str or list) – Author or list of authors.
  • contact (str or list) – List of emails. Ordering should be the same as for author
  • catalog (SpecCatalog) – The SpecCatalog object for this SpecNamespace
classmethod types_key()[source]

Get the key used for specifying types to include from a file or namespace

Override this method to use a different name for ‘data_types’

class pynwb.spec.NWBNamespaceBuilder(doc, name, full_name=None, version=None, author=None, contact=None)[source]

Bases: hdmf.spec.write.NamespaceBuilder

A class for writing namespace and spec files for extensions of types in the NWB core namespace

Create a NWBNamespaceBuilder

Parameters:
  • doc (str) – a description about what this namespace represents
  • name (str) – the name of this namespace
  • full_name (str) – extended full name of this namespace
  • version (str or tuple or list) – Version number of the namespace
  • author (str or list) – Author or list of authors.
  • contact (str or list) – List of emails. Ordering should be the same as for author