DimensionUniverse¶
-
class
lsst.daf.butler.
DimensionUniverse
¶ Bases:
lsst.daf.butler.DimensionGraph
Specialization for a
DimensionGraph
that defines a complete system of dimensions.DimensionUniverse
instances can only be constructed via thefromConfig
method.Attributes Summary
elements
A set containing both Dimension
andDimensionJoin
objects (DimensionSet
).empty
Return an empty graph in this universe ( DimensionGraph
).leaves
Dimensions that are not required or implied dependencies of any other dimension in the graph ( DimensionSet
).names
The names of all elements ( set
-like, immutable).universe
The graph of all dimensions compatible with self ( DimensionGraph
).Methods Summary
extract
([dimensions, joins, implied])Return a new graph containing the given elements. findIf
(predicate[, default])Return the element in self
that matches the given predicate.fromConfig
([config])Construct a “universe” DimensionGraph
from configuration.get
(key[, default])Return the element with the given name, or default
if it does not exist.getRegionHolder
()Return the Dimension that provides the spatial region for this combination of dimensions. implied
([only])Return the (recursive) implied dependencies of the dimensions in this graph. intersection
(*others[, implied])Return a new graph containing all elements that are in both self
isdisjoint
(other)Return True
if there are no dimensions in bothself
andother
, andFalse
otherwise.issubset
(other)Return True
if all dimensions inself
are also inother
.issuperset
(other)Return True
if all dimensions inother
are also inself
, andFalse
otherwise.joins
([summaries])Return the DimensionJoin
objects held by this graph.links
()Return the names of all fields that uniquely identify these dimensions in a data ID dict. toSet
()Return a DimensionSet
with the same dimensions asself
.union
(*others[, implied])Return a new graph containing all elements that are in self
or any of the other given graphs.withLink
(link)Return the set of Dimension
andDimensionJoin
objects that have the given link name in their primary or foreign keys.Attributes Documentation
-
elements
¶ A set containing both
Dimension
andDimensionJoin
objects (DimensionSet
).
-
empty
¶ Return an empty graph in this universe (
DimensionGraph
).
-
leaves
¶ Dimensions that are not required or implied dependencies of any other dimension in the graph (
DimensionSet
).
-
names
¶ The names of all elements (
set
-like, immutable).The order of the names is consistent with the iteration order of the
DimensionSet
itself.
-
universe
¶ The graph of all dimensions compatible with self (
DimensionGraph
).The universe of a
DimensionGraph
that is itself a universe isself
.
Methods Documentation
-
extract
(dimensions=(), joins=(), implied=False)¶ Return a new graph containing the given elements.
Parameters: Returns: - subgraph :
DimensionGraph
A new graph containing the given elements and their dependencies.
- subgraph :
-
findIf
(predicate, default=None)¶ Return the element in
self
that matches the given predicate.Parameters: - predicate : callable
Callable that takes a single
DimensionElement
argument and returns abool
, indicating whether the given value should be returned.- default :
DimensionElement
, optional Object to return if no matching elements are found.
Returns: - matching :
DimensionElement
Element matching the given predicate.
Raises: - ValueError
Raised if multiple elements match the given predicate.
-
static
fromConfig
(config=None)¶ Construct a “universe”
DimensionGraph
from configuration.Parameters: - config :
DimensionConfig
, optional Configuration specifying the elements and their relationships. If not provided, will be loaded from the default search path (see
ConfigSubset
).
Returns: - universe :
DimensionGraph
A self-contained
DimensionGraph
containing all of the elements defined in the given configuration.
- config :
-
get
(key, default=None)¶ Return the element with the given name, or
default
if it does not exist.key
may also be aDimension
, in which case an equivalent object will be returned.
-
getRegionHolder
()¶ Return the Dimension that provides the spatial region for this combination of dimensions.
Returns: - holder :
DimensionElement
, or None. Dimension
orDimensionJoin
that provides a unique region for this graph, orNone
if there is no region or multiple regions.holder.hasRegion
is guaranteed to beTrue
ifholder
is notNone
.
- holder :
-
implied
(only=True)¶ Return the (recursive) implied dependencies of the dimensions in this graph.
Parameters: Returns: - set :
DimensionSet
A set containing dimensions that are implied dependencies of those in the graph, possibly (if
only
isFalse
) along with those in the graph.
- set :
-
intersection
(*others, implied=False)¶ - Return a new graph containing all elements that are in both
self
- and all of the other given graphs.
Parameters: Returns: - result :
DimensionGraph
Graph containing all elements in all of the inputs.
- Return a new graph containing all elements that are in both
-
isdisjoint
(other)¶ Return
True
if there are no dimensions in bothself
andother
, andFalse
otherwise.All graphs (including the empty graph) are disjoint with the empty graph.
-
issubset
(other)¶ Return
True
if all dimensions inself
are also inother
.The empty graph is a subset of all graphs (including the empty graph).
-
issuperset
(other)¶ Return
True
if all dimensions inother
are also inself
, andFalse
otherwise.All graphs (including the empty graph) are supersets of the empty graph.
-
joins
(summaries=True)¶ Return the
DimensionJoin
objects held by this graph.Parameters: Returns: - joins :
DimensionSet
The joins held by this graph, possibly filtered.
- joins :
-
links
()¶ Return the names of all fields that uniquely identify these dimensions in a data ID dict.
Returns:
-
toSet
()¶ Return a
DimensionSet
with the same dimensions asself
.
-
union
(*others, implied=False)¶ Return a new graph containing all elements that are in
self
or any of the other given graphs.Parameters: Returns: - result :
DimensionGraph
Graph containing any elements in any of the inputs.
- result :
-
withLink
(link)¶ Return the set of
Dimension
andDimensionJoin
objects that have the given link name in their primary or foreign keys.Parameters: - link :
str
Key field name.
Returns: - dimensions :
DimensionSet
Set potentially containing both
Dimension
andDimensionJoin
elements.
- link :
-