hdmf.build.builders module¶
- class hdmf.build.builders.Builder(name, parent=None, source=None)¶
Bases:
dict- Parameters:
- property path¶
The path of this builder.
- property name¶
The name of this builder.
- property source¶
The source of this builder.
- property parent¶
The parent builder of this builder.
- class hdmf.build.builders.BaseBuilder(name, attributes={}, parent=None, source=None)¶
Bases:
Builder- Parameters:
name (
str) – The name of the builder.attributes (
dict) – A dictionary of attributes to create in this builder.parent (
GroupBuilder) – The parent builder of this builder.source (
str) – The source of the data represented in this builder
- property location¶
The location of this Builder in its source.
- property attributes¶
The attributes stored in this Builder object.
- class hdmf.build.builders.GroupBuilder(name, groups={}, datasets={}, attributes={}, links={}, parent=None, source=None)¶
Bases:
BaseBuilderCreate a builder object for a group.
- Parameters:
name (
str) – The name of the group.groups (
dictorlist) – A dictionary or list of subgroups to add to this group. If a dict is provided, only the values are used.datasets (
dictorlist) – A dictionary or list of datasets to add to this group. If a dict is provided, only the values are used.attributes (
dict) – A dictionary of attributes to create in this group.links (
dictorlist) – A dictionary or list of links to add to this group. If a dict is provided, only the values are used.parent (
GroupBuilder) – The parent builder of this builder.source (
str) – The source of the data represented in this builder.
- property source¶
The source of this Builder
- property groups¶
The subgroups contained in this group.
- property datasets¶
The datasets contained in this group.
- property links¶
The links contained in this group.
- set_attribute(name, value)¶
Set an attribute for this group.
- Parameters:
name (
str) – The name of the attribute.value (None) – The attribute value.
- set_group(builder)¶
Add a subgroup to this group.
- Parameters:
builder (
GroupBuilder) – The GroupBuilder to add to this group.
- set_dataset(builder)¶
Add a dataset to this group.
- Parameters:
builder (
DatasetBuilder) – The DatasetBuilder to add to this group.
- set_link(builder)¶
Add a link to this group.
- Parameters:
builder (
LinkBuilder) – The LinkBuilder to add to this group.
- is_empty()¶
Returns true if there are no datasets, links, attributes, and non-empty subgroups. False otherwise.
- __getitem__(key)¶
Like dict.__getitem__, but looks in groups, datasets, attributes, and links sub-dictionaries. Key can be a posix path to a sub-builder.
- get(key, default=None)¶
Like dict.get, but looks in groups, datasets, attributes, and links sub-dictionaries. Key can be a posix path to a sub-builder.
- items()¶
Like dict.items, but iterates over items in groups, datasets, attributes, and links sub-dictionaries.
- keys()¶
Like dict.keys, but iterates over keys in groups, datasets, attributes, and links sub-dictionaries.
- values()¶
Like dict.values, but iterates over values in groups, datasets, attributes, and links sub-dictionaries.
- class hdmf.build.builders.DatasetBuilder(name, data=None, dtype=None, attributes={}, dimension_labels=None, maxshape=None, chunks=False, parent=None, source=None)¶
Bases:
BaseBuilderCreate a Builder object for a dataset
- Parameters:
name (
str) – The name of the dataset.data (
ndarrayorlistortupleorDatasetorArrayorStrDatasetorHDMFDatasetorAbstractDataChunkIteratororstrorintorfloatorbytesorboolorDataIOorDatasetBuilderorRegionBuilderorIterableordatetimeordate) – The data in this dataset.dtype (
typeordtypeorstrorlist) – The datatype of this dataset.attributes (
dict) – A dictionary of attributes to create in this dataset.dimension_labels (
tuple) – A list of labels for each dimension of this dataset from the spec. Currently this is supplied only on build.maxshape (
intortuple) – The shape of this dataset. Use None for scalars.chunks (
bool) – Whether or not to chunk this dataset.parent (
GroupBuilder) – The parent builder of this builder.source (
str) – The source of the data in this builder.
- OBJECT_REF_TYPE = 'object'¶
- REGION_REF_TYPE = 'region'¶
- property data¶
The data stored in the dataset represented by this builder.
- property dimension_labels¶
Labels for each dimension of this dataset from the spec.
- property chunks¶
Whether or not this dataset is chunked.
- property maxshape¶
The max shape of this dataset.
- property dtype¶
The data type of this dataset.
- class hdmf.build.builders.LinkBuilder(builder, name=None, parent=None, source=None)¶
Bases:
BuilderCreate a builder object for a link.
- Parameters:
builder (
DatasetBuilderorGroupBuilder) – The target group or dataset of this link.name (
str) – The name of the linkparent (
GroupBuilder) – The parent builder of this buildersource (
str) – The source of the data in this builder
- property builder¶
The target builder object.
- class hdmf.build.builders.ReferenceBuilder(builder)¶
Bases:
dictCreate a builder object for a reference.
- Parameters:
builder (
DatasetBuilderorGroupBuilder) – The group or dataset this reference applies to.
- property builder¶
The target builder object.
- class hdmf.build.builders.RegionBuilder(region, builder)¶
Bases:
ReferenceBuilderCreate a builder object for a region reference.
- Parameters:
region (
sliceortupleorlistorRegionReference) – The region, i.e. slice or indices, into the target dataset.builder (
DatasetBuilder) – The dataset this region reference applies to.
- property region¶
The selected region of the target dataset.