GovernorDimensionRestriction

class lsst.daf.butler.registry.summaries.GovernorDimensionRestriction(mapping: NamedKeyDict[GovernorDimension, Set[str]])

Bases: NamedKeyMapping[GovernorDimension, AbstractSet[str]]

A custom mapping that represents a restriction on the values one or more governor dimensions may take in some context.

Parameters:
mappingNamedKeyDict [ GovernorDimension, Set [ str ]]

Mapping from governor dimension to the values it may take. Dimensions not present in the mapping are not constrained at all.

Attributes Summary

names

Return the set of names associated with the keys, in the same order.

Methods Summary

add(dimension, value)

Add a single dimension value to the restriction.

byName()

Return a Mapping with names as keys and the self values.

copy()

Return a deep copy of this object.

get(k[,d])

intersection(*others)

Construct a restriction that permits only values permitted by all of the input restrictions.

intersection_update(other)

Update self to include only dimension values in both self and other.

items()

keys()

makeEmpty(universe)

Construct a GovernorDimensionRestriction that allows no values for any governor dimension in the given DimensionUniverse.

makeFull()

Construct a GovernorDimensionRestriction that allows any value for any governor dimension.

union(*others)

Construct a restriction that permits any values permitted by any of the input restrictions.

update(other)

Update self to include all dimension values in either self or other.

update_extract(data_id)

Update self to include all governor dimension values in the given data ID (in addition to those already in self).

values()

Attributes Documentation

names

Methods Documentation

add(dimension: GovernorDimension, value: str) None

Add a single dimension value to the restriction.

Parameters:
dimensionGovernorDimension

Dimension to update.

valuestr

Value to allow for this dimension.

byName() Dict[str, V_co]

Return a Mapping with names as keys and the self values.

Returns:
dictionarydict

A dictionary with the same values (and iteration order) as self, with str names as keys. This is always a new object, not a view.

copy() GovernorDimensionRestriction

Return a deep copy of this object.

Returns:
copyGovernorDimensionRestriction

A copy of self that can be modified without modifying self at all.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
intersection(*others: Mapping[GovernorDimension, Union[str, Iterable[str]]]) GovernorDimensionRestriction

Construct a restriction that permits only values permitted by all of the input restrictions.

Parameters:
*othersMapping [ Dimension, str or Iterable [ str ] ]

Mappings to intersect with self. These may be other GovernorDimensionRestriction instances or any other kind of mapping from dimension to str or iterable of str.

Returns
——-
intersectionGovernorDimensionRestriction

New restriction object that represents the intersection of self with others.

intersection_update(other: Mapping[GovernorDimension, Union[str, Iterable[str]]]) None

Update self to include only dimension values in both self and other.

Parameters:
otherMapping [ Dimension, str or Iterable [ str ] ]

Mapping to intersect into self. This may be another GovernorDimensionRestriction or any other mapping from dimension to str or iterable of str.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
classmethod makeEmpty(universe: DimensionUniverse) GovernorDimensionRestriction

Construct a GovernorDimensionRestriction that allows no values for any governor dimension in the given DimensionUniverse.

Parameters:
universeDimensionUniverse

Object that manages all dimensions.

Returns:
restrictionGovernorDimensionRestriction

Restriction instance that maps all governor dimensions to an empty set.

classmethod makeFull() GovernorDimensionRestriction

Construct a GovernorDimensionRestriction that allows any value for any governor dimension.

Returns:
restrictionGovernorDimensionRestriction

Restriction instance that contains no keys, and hence contains allows any value for any governor dimension.

union(*others: Mapping[GovernorDimension, Union[str, Iterable[str]]]) GovernorDimensionRestriction

Construct a restriction that permits any values permitted by any of the input restrictions.

Parameters:
*othersMapping [ Dimension, str or Iterable [ str ] ]

Mappings to union into self. These may be other GovernorDimensionRestriction instances or any other kind of mapping from dimension to str or iterable of str.

Returns:
unionedGovernorDimensionRestriction

New restriction object that represents the union of self with others.

update(other: Mapping[GovernorDimension, Union[str, Iterable[str]]]) None

Update self to include all dimension values in either self or other.

Parameters:
otherMapping [ Dimension, str or Iterable [ str ] ]

Mapping to union into self. This may be another GovernorDimensionRestriction or any other mapping from dimension to str or iterable of str.

update_extract(data_id: DataCoordinate) None

Update self to include all governor dimension values in the given data ID (in addition to those already in self).

Parameters:
data_idDataCoordinate

Data ID from which governor dimension values should be extracted. Values for non-governor dimensions are ignored.

values() an object providing a view on D's values