DimensionUniverse¶
- 
class lsst.daf.butler.DimensionUniverse¶
- Bases: - object- Self-consistent set of dimensions. - A parent class that represents a complete, self-consistent set of dimensions and their relationships. - DimensionUniverseis not a class-level singleton, but all instances are tracked in a singleton map keyed by the version number and namespace in the configuration they were loaded from. Because these universes are solely responsible for constructing- DimensionElementinstances, these are also indirectly tracked by that singleton as well.- Parameters: - config : Config, optional
- Configuration object from which dimension definitions can be extracted. Ignored if - builderis provided, or if- versionis provided and an instance with that version already exists.
- version : int, optional
- Integer version for this - DimensionUniverse. If not provided, a version will be obtained from- builderor- config.
- namespace : str, optional
- Namespace of this - DimensionUniverse, combined with the version to provide universe safety for registries that use different dimension definitions.
- builder : DimensionConstructionBuilder, optional
- Builder object used to initialize a new instance. Ignored if - versionis provided and an instance with that version already exists. Should not have had- finishcalled; this will be called if needed by- DimensionUniverse.
 - Attributes Summary - skypix- All skypix systems known to this universe. - Methods Summary - expandDimensionNameSet(names)- Expand a set of dimension names in-place. - extract(iterable, str]])- Construct graph from iterable. - get(name, default)- Return the - DimensionElementwith the given name or a default.- getDatabaseElements()- Return set of all - DatabaseDimensionElementinstances in universe.- getDimensionIndex(name)- Return the position of the named dimension. - getElementIndex(name)- Return the position of the named dimension element. - getEncodeLength()- Return encoded size of graph. - getGovernorDimensions()- Return a set of all - GovernorDimensioninstances in this universe.- getStaticDimensions()- Return a set of all static dimensions in this universe. - getStaticElements()- Return a set of all static elements in this universe. - makePacker(name, dataId)- Make a dimension packer. - sorted(elements, str]], *, reverse)- Return a sorted version of the given iterable of dimension elements. - Attributes Documentation - 
skypix¶
- All skypix systems known to this universe. 
 - Methods Documentation - 
expandDimensionNameSet(names: Set[str]) → None¶
- Expand a set of dimension names in-place. - Includes recursive dependencies. - This is an advanced interface for cases where constructing a - DimensionGraph(which also expands required dependencies) is impossible or undesirable.- Parameters: 
 - 
extract(iterable: Iterable[Union[lsst.daf.butler.core.dimensions._elements.Dimension, str]]) → lsst.daf.butler.core.dimensions._graph.DimensionGraph¶
- Construct graph from iterable. - Constructs a - DimensionGraphfrom a possibly-heterogenous iterable of- Dimensioninstances and string names thereof.- Constructing - DimensionGraphdirectly from names or dimension instances is slightly more efficient when it is known in advance that the iterable is not heterogenous.- Parameters: - iterable: iterable of `Dimension` or `str`
- Dimensions that must be included in the returned graph (their dependencies will be as well). 
 - Returns: - graph : DimensionGraph
- A - DimensionGraphinstance containing all given dimensions.
 
 - 
get(name: str, default: Optional[lsst.daf.butler.core.dimensions._elements.DimensionElement] = None) → Optional[lsst.daf.butler.core.dimensions._elements.DimensionElement]¶
- Return the - DimensionElementwith the given name or a default.- Parameters: - name : str
- Name of the element. 
- default : DimensionElement, optional
- Element to return if the named one does not exist. Defaults to - None.
 - Returns: - element : DimensionElement
- The named element. 
 
- name : 
 - 
getDatabaseElements() → lsst.daf.butler.core.named.NamedValueAbstractSet[lsst.daf.butler.core.dimensions._database.DatabaseDimensionElement][lsst.daf.butler.core.dimensions._database.DatabaseDimensionElement]¶
- Return set of all - DatabaseDimensionElementinstances in universe.- This does not include - GovernorDimensioninstances, which are backed by the database but do not inherit from- DatabaseDimensionElement.- Returns: - elements : NamedValueAbstractSet[DatabaseDimensionElement]
- A frozen set of - DatabaseDimensionElementinstances.
 
- elements : 
 - 
getDimensionIndex(name: str) → int¶
- Return the position of the named dimension. - This position is in this universe’s sorting of all dimensions. - Parameters: - name : str
- Name of the dimension. 
 - Returns: - index : int
- Sorting index for this dimension. 
 - Notes - The dimension sort order for a universe is consistent with the element order (all dimensions are elements), and either can be used to sort dimensions if used consistently. But there are also some contexts in which contiguous dimension-only indices are necessary or at least desirable. 
- name : 
 - 
getElementIndex(name: str) → int¶
- Return the position of the named dimension element. - The position is in this universe’s sorting of all elements. - Parameters: - name : str
- Name of the element. 
 - Returns: - index : int
- Sorting index for this element. 
 
- name : 
 - 
getEncodeLength() → int¶
- Return encoded size of graph. - Returns the size (in bytes) of the encoded size of - DimensionGraphinstances in this universe.- See - DimensionGraph.encodeand- DimensionGraph.decodefor more information.
 - 
getGovernorDimensions() → lsst.daf.butler.core.named.NamedValueAbstractSet[lsst.daf.butler.core.dimensions._governor.GovernorDimension][lsst.daf.butler.core.dimensions._governor.GovernorDimension]¶
- Return a set of all - GovernorDimensioninstances in this universe.- Returns: - governors : NamedValueAbstractSet[GovernorDimension]
- A frozen set of - GovernorDimensioninstances.
 
- governors : 
 - 
getStaticDimensions() → lsst.daf.butler.core.named.NamedValueAbstractSet[lsst.daf.butler.core.dimensions._elements.Dimension][lsst.daf.butler.core.dimensions._elements.Dimension]¶
- Return a set of all static dimensions in this universe. - Non-static dimensions that are created as needed may also exist, but these are guaranteed to have no direct relationships to other elements (though they may have spatial or temporal relationships). - Returns: - dimensions : NamedValueAbstractSet[Dimension]
- A frozen set of - Dimensioninstances.
 
- dimensions : 
 - 
getStaticElements() → lsst.daf.butler.core.named.NamedValueAbstractSet[lsst.daf.butler.core.dimensions._elements.DimensionElement][lsst.daf.butler.core.dimensions._elements.DimensionElement]¶
- Return a set of all static elements in this universe. - Non-static elements that are created as needed may also exist, but these are guaranteed to have no direct relationships to other elements (though they may have spatial or temporal relationships). - Returns: - elements : NamedValueAbstractSet[DimensionElement]
- A frozen set of - DimensionElementinstances.
 
- elements : 
 - 
makePacker(name: str, dataId: DataCoordinate) → DimensionPacker¶
- Make a dimension packer. - Constructs a - DimensionPackerthat can pack data ID dictionaries into unique integers.- Parameters: - name : str
- Name of the packer, matching a key in the “packers” section of the dimension configuration. 
- dataId : DataCoordinate
- Fully-expanded data ID that identifies the at least the “fixed” dimensions of the packer (i.e. those that are assumed/given, setting the space over which packed integer IDs are unique). - dataId.hasRecords()must return- True.
 
- name : 
 - 
sorted(elements: Iterable[Union[E, str]], *, reverse: bool = False) → List[E]¶
- Return a sorted version of the given iterable of dimension elements. - The universe’s sort order is topological (an element’s dependencies precede it), with an unspecified (but deterministic) approach to breaking ties. - Parameters: - elements : iterable of DimensionElement.
- Elements to be sorted. 
- reverse : bool, optional
- If - True, sort in the opposite order.
 - Returns: - sorted : listofDimensionElement
- A sorted list containing the same elements that were given. 
 
- elements : iterable of 
 
- config :