pynwb.spec module

class pynwb.spec.BaseStorageOverride

Bases: object

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

classmethod def_key()

Get the key used to define a data_type definition.

Override this method to use a different keyword for ‘data_type_def’

classmethod inc_key()

Get the key used to define a data_type include.

Override this method to use a different keyword for ‘data_type_inc’

neurodata_type_def
neurodata_type_inc
classmethod type_key()

Get the key used to store data type on an instance

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

class pynwb.spec.NWBAttributeSpec(name, doc, dtype, shape=None, dims=None, required=True, parent=None, value=None, default_value=None)

Bases: form.spec.spec.AttributeSpec

Parameters:
  • name (str) – The name of this attribute
  • doc (str) – a description about what this specification represents
  • dtype (str) – 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 (AttributeSpec) – 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.NWBDatasetSpec(doc, dtype, 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)

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

The Spec class to use for NWB specifications

Parameters:
  • doc (str) – a description about what this specification represents
  • dtype (str or type or list) – 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.NWBDtypeSpec(name, doc, dtype)

Bases: form.spec.spec.DtypeSpec

Parameters:
  • name (str) – the name of this column
  • doc (str) – a description about what this data type is
  • dtype (str or type or list) – the data type of this column
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)

Bases: pynwb.spec.BaseStorageOverride, form.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
add_dataset(doc, dtype, 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)

Add a new specification for a subgroup to this group specification

Parameters:
  • doc (str) – a description about what this specification represents
  • dtype (str or type or list) – 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
add_group(doc, name=None, default_name=None, groups=[], datasets=[], attributes=[], links=[], linkable=True, quantity=1, neurodata_type_def=None, neurodata_type_inc=None)

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
classmethod dataset_spec_cls()
get_neurodata_type(neurodata_type)

Get a specification by “data_type”

Parameters:neurodata_type (str) – the neurodata_type to retrieve
class pynwb.spec.NWBLinkSpec(doc, target_type, quantity=1, name=None)

Bases: form.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.NWBNamespace(doc, name, schema, full_name=None, version=None, date=None, author=None, contact=None, catalog=None)

Bases: form.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()
class pynwb.spec.NWBNamespaceBuilder(doc, name, full_name=None, version=None, author=None, contact=None)

Bases: form.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