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, isCalibration: bool = False)¶
- Bases: - object- A named category of Datasets. - Defines how they are organized, related, and stored. - A concrete, final class whose instances represent - DatasetTypes.- DatasetTypeinstances may be constructed without a- Registry, but they must be registered via- Registry.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 a- DimensionGraph,- universemust be provided as well.
- storageClass : StorageClassorstr
- Instance of a - StorageClassor name of- StorageClassthat defines how this- DatasetTypeis persisted.
- parentStorageClass : StorageClassorstr, optional
- Instance of a - StorageClassor name of- StorageClassthat defines how the composite parent is persisted. Must be- Noneif 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 a- DimensionGraph.
- isCalibration : bool, optional
- If - True, this dataset type may be included in- CALIBRATIONcollections.
 - Attributes Summary - PlaceholderParentStorageClass- Placeholder StorageClass that can be used temporarily for a component. - VALID_NAME_REGEX- dimensions- Return the - Dimensions fir this dataset type.- name- Return a string name for the Dataset. - parentStorageClass- Return the storage class of the composite containing this component. - storageClass- Return - StorageClassinstance associated with this dataset type.- Methods Summary - component()- Return the component name (if defined). - componentTypeName(component)- Derive a component dataset type from a composite. - finalizeParentStorageClass(newParent)- Finalize the parent storage class definition. - from_json(json_str, universe, registry)- Return new class from JSON string. - from_simple(simple, str], universe, registry)- Construct a new object from the simplified form. - isCalibration()- Return if datasets of this type can be in calibration collections. - isComponent()- Return whether this - DatasetTyperefers to a component.- isComposite()- Return whether this - DatasetTypeis a composite.- makeAllComponentDatasetTypes()- Return all component dataset types for this composite. - makeComponentDatasetType(component)- Return a component dataset type from a composite. - makeCompositeDatasetType()- Return a composite dataset type from the component. - nameAndComponent()- Return the root name of this dataset type and any component. - nameWithComponent(datasetTypeName, componentName)- Form a valid DatasetTypeName from a parent and component. - splitDatasetTypeName(datasetTypeName)- Return the root name and the component from a composite name. - to_json(minimal)- Convert this class to JSON form. - to_simple(minimal)- Convert this class to a simple python type. - 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¶
- Return the - Dimensions fir this dataset type.- The dimensions label and relate instances of this - DatasetType(- DimensionGraph).
 - 
name¶
- Return a string name for the Dataset. - Mmust correspond to the same - DatasetTypeacross all Registries.
 - 
parentStorageClass¶
- Return the storage class of the composite containing this component. - 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¶
- Return - StorageClassinstance associated with this dataset type.- The - StorageClassdefines how this- DatasetTypeis 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]¶
- Return the component name (if defined). - Returns: - comp : str
- Name of component part of DatasetType name. - Noneif this- DatasetTypeis not associated with a component.
 
- comp : 
 - 
componentTypeName(component: str) → str¶
- Derive a component dataset type from a composite. - 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¶
- Finalize the parent storage class definition. - Replaces 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 : 
 - 
classmethod from_json(json_str: str, universe: Optional[DimensionUniverse] = None, registry: Optional[Registry] = None) → SupportsSimple¶
- Return new class from JSON string. - Converts a JSON string created by - to_jsonand return something of the supplied class.- Parameters: - json_str : str
- Representation of the dimensions in JSON format as created by - to_json().
- universe : DimensionUniverse, optional
- The special graph of all known dimensions. Passed directly to - from_simple().
- registry : lsst.daf.butler.Registry, optional
- Registry to use to convert simple name of a DatasetType to a full - DatasetType. Passed directly to- from_simple().
 - Returns: - constructed : Any
- Newly-constructed object. 
 
- json_str : 
 - 
classmethod from_simple(simple: Union[Dict, str], universe: Optional[DimensionUniverse] = None, registry: Optional[Registry] = None) → DatasetType¶
- Construct a new object from the simplified form. - This is usally data returned from the - to_simplemethod.- Parameters: - simple : dictof [str,Any] orstr
- The value returned by - to_simple().
- universe : DimensionUniverse
- The special graph of all known dimensions of which this graph will be a subset. Can be - Noneif a registry is provided.
- registry : lsst.daf.butler.Registry, optional
- Registry to use to convert simple name of a DatasetType to a full - DatasetType. Can be- Noneif a full description of the type is provided along with a universe.
 - Returns: - datasetType : DatasetType
- Newly-constructed object. 
 
- simple : 
 - 
isCalibration() → bool¶
- Return if datasets of this type can be in calibration collections. - Returns: 
 - 
isComponent() → bool¶
- Return whether this - DatasetTyperefers to a component.- Returns: - isComponent : bool
- Trueif this- DatasetTypeis a component,- Falseotherwise.
 
- isComponent : 
 - 
isComposite() → bool¶
- Return whether this - DatasetTypeis a composite.- Returns: - isComposite : bool
- Trueif this- DatasetTypeis a composite type,- Falseotherwise.
 
- isComposite : 
 - 
makeAllComponentDatasetTypes() → List[lsst.daf.butler.core.datasets.type.DatasetType]¶
- Return all component dataset types for this composite. - 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 component dataset type from a composite. - Assumes the same dimensions as the parent. - Parameters: - component : str
- Name of component 
 - Returns: - datasetType : DatasetType
- A new DatasetType instance. 
 
- component : 
 - 
makeCompositeDatasetType() → lsst.daf.butler.core.datasets.type.DatasetType¶
- Return a composite dataset type from the component. - Returns: - composite : DatasetType
- The composite dataset type. 
 - Raises: - RuntimeError
- Raised if this dataset type is not a component dataset type. 
 
- composite : 
 - 
nameAndComponent() → Tuple[str, Optional[str]]¶
- Return the root name of this dataset type and any component. - 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]]¶
- Return the root name and the component from a composite 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 of- aand a component name of- b.c.
- datasetTypeName : 
 - 
to_json(minimal: bool = False) → str¶
- Convert this class to JSON form. - The class type is not recorded in the JSON so the JSON decoder must know which class is represented. - Parameters: - minimal : bool, optional
- Use minimal serialization. Requires Registry to convert back to a full type. 
 - Returns: - json : str
- The class in JSON string format. 
 
- minimal : 
 
- name :