DatasetType¶
- 
class 
lsst.daf.butler.DatasetType(name: str, dimensions: Union[DimensionGraph, Iterable[Dimension]], storageClass: Union[StorageClass, str], parentStorageClass: Optional[Union[StorageClass, str]] = None, *, universe: Optional[DimensionUniverse] = None)¶ Bases:
objectA named category of Datasets that defines how they are organized, related, and stored.
A concrete, final class whose instances represent
DatasetTypes.DatasetTypeinstances may be constructed without aRegistry, but they must be registered viaRegistry.registerDatasetType()before corresponding Datasets may be added.DatasetTypeinstances are immutable.Parameters: - name : 
str A string name for the Dataset; must correspond to the same
DatasetTypeacross all Registries. Names must start with an upper or lowercase letter, and may contain only letters, numbers, and underscores. Component dataset types should contain a single period separating the base dataset type name from the component name (and may be recursive).- dimensions : 
DimensionGraphor iterable ofDimension Dimensions used to label and relate instances of this
DatasetType. If not aDimensionGraph,universemust be provided as well.- storageClass : 
StorageClassorstr Instance of a
StorageClassor name ofStorageClassthat defines how thisDatasetTypeis persisted.- parentStorageClass : 
StorageClassorstr, optional Instance of a
StorageClassor name ofStorageClassthat defines how the composite parent is persisted. Must beNoneif this is not a component. Mandatory if it is a component but can be the special temporary placeholder (DatasetType.PlaceholderParentStorageClass) to allow construction with an intent to finalize later.- universe : 
DimensionUniverse, optional Set of all known dimensions, used to normalize
dimensionsif it is not already aDimensionGraph.
Attributes Summary
PlaceholderParentStorageClassPlaceholder StorageClass that can be used temporarily for a component. VALID_NAME_REGEXdimensionsThe Dimensions that label and relate instances of thisDatasetType(DimensionGraph).nameA string name for the Dataset; must correspond to the same DatasetTypeacross all Registries.parentStorageClassStorageClassinstance that defines how the composite associated with thisDatasetTypeis persisted.storageClassStorageClassinstance that defines how thisDatasetTypeis persisted.Methods Summary
component()Component name (if defined) componentTypeName(component)Given a component name, derive the datasetTypeName of that component finalizeParentStorageClass(newParent)Replace the current placeholder parent storage class with the real parent. isComponent()Boolean indicating whether this DatasetTyperefers to a component of a composite.isComposite()Boolean indicating whether this DatasetTypeis a composite type.makeAllComponentDatasetTypes()Return all the component dataset types assocaited with this dataset type. makeComponentDatasetType(component)Return a DatasetType suitable for the given component, assuming the same dimensions as the parent. nameAndComponent()Return the root name of this dataset type and the component name (if defined). nameWithComponent(datasetTypeName, componentName)Form a valid DatasetTypeName from a parent and component. splitDatasetTypeName(datasetTypeName)Given a dataset type name, return the root name and the component name. Attributes Documentation
- 
PlaceholderParentStorageClass= StorageClass('PlaceHolder')¶ Placeholder StorageClass that can be used temporarily for a component.
This can be useful in pipeline construction where we are creating dataset types without a registry.
- 
VALID_NAME_REGEX= re.compile('^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*$')¶ 
- 
dimensions¶ The
Dimensions that label and relate instances of thisDatasetType(DimensionGraph).
- 
name¶ A string name for the Dataset; must correspond to the same
DatasetTypeacross all Registries.
- 
parentStorageClass¶ StorageClassinstance that defines how the composite associated with thisDatasetTypeis persisted.Note that if DatasetType was constructed with a name of a StorageClass then Butler has to be initialized before using this property. Can be
Noneif this is not a component of a composite. Must be defined if this is a component.
- 
storageClass¶ StorageClassinstance that defines how thisDatasetTypeis persisted. Note that if DatasetType was constructed with a name of a StorageClass then Butler has to be initialized before using this property.
Methods Documentation
- 
component() → Optional[str]¶ Component name (if defined)
Returns: - comp : 
str Name of component part of DatasetType name.
Noneif thisDatasetTypeis not associated with a component.
- comp : 
 
- 
componentTypeName(component: str) → str¶ Given a component name, derive the datasetTypeName of that component
Parameters: - component : 
str Name of component
Returns: - derived : 
str Compound name of this
DatasetTypeand the component.
Raises: - KeyError
 Requested component is not supported by this
DatasetType.
- component : 
 
- 
finalizeParentStorageClass(newParent: lsst.daf.butler.core.storageClass.StorageClass) → None¶ Replace the current placeholder parent storage class with the real parent.
Parameters: - newParent : 
StorageClass The new parent to be associated with this composite dataset type. This replaces the temporary placeholder parent that was specified during construction.
Raises: - ValueError
 Raised if this dataset type is not a component of a composite. Raised if a StorageClass is not given. Raised if the parent currently associated with the dataset type is not a placeholder.
- newParent : 
 
- 
isComponent() → bool¶ Boolean indicating whether this
DatasetTyperefers to a component of a composite.Returns: - isComponent : 
bool Trueif thisDatasetTypeis a component,Falseotherwise.
- isComponent : 
 
- 
isComposite() → bool¶ Boolean indicating whether this
DatasetTypeis a composite type.Returns: - isComposite : 
bool Trueif thisDatasetTypeis a composite type,Falseotherwise.
- isComposite : 
 
- 
makeAllComponentDatasetTypes() → List[lsst.daf.butler.core.datasets.type.DatasetType]¶ Return all the component dataset types assocaited with this dataset type.
Returns: - all : 
listofDatasetType All the component dataset types. If this is not a composite then returns an empty list.
- all : 
 
- 
makeComponentDatasetType(component: str) → lsst.daf.butler.core.datasets.type.DatasetType¶ Return a DatasetType suitable for the given component, assuming the same dimensions as the parent.
Parameters: - component : 
str Name of component
Returns: - datasetType : 
DatasetType A new DatasetType instance.
- component : 
 
- 
nameAndComponent() → Tuple[str, Optional[str]]¶ Return the root name of this dataset type and the component name (if defined).
Returns: - rootName : 
str Root name for this
DatasetTypewithout any components.- componentName : 
str The component if it has been specified, else
None.
- rootName : 
 
- 
static 
nameWithComponent(datasetTypeName: str, componentName: str) → str¶ Form a valid DatasetTypeName from a parent and component.
No validation is performed.
Parameters: Returns: - compTypeName : 
str Name to use for component DatasetType.
- compTypeName : 
 
- 
static 
splitDatasetTypeName(datasetTypeName: str) → Tuple[str, Optional[str]]¶ Given a dataset type name, return the root name and the component name.
Parameters: - datasetTypeName : 
str The name of the dataset type, can include a component using a “.”-separator.
Returns: Notes
If the dataset type name is
a.b.cthis method will return a root name ofaand a component name ofb.c.- datasetTypeName : 
 
- name :