RegistryDefaults¶
- class lsst.daf.butler.registry.RegistryDefaults(collections: Any = None, run: str | None = None, infer: bool = True, **kwargs: str)¶
Bases:
object
A struct used to provide the default collections searched or written to by a
Registry
orButler
instance.- Parameters:
- collections
str
orIterable
[str
], optional An expression specifying the collections to be searched (in order) when reading datasets. If a default value for a governor dimension is not given via
**kwargs
, and exactly one value for that dimension appears in the datasets incollections
, that value is also used as the default for that dimension. This may be astr
collection name or an iterable thereof. See Collection expressions for more information. These collections are not registered automatically and must be manually registered before they are used by anyRegistry
orButler
method, but they may be manually registered after aRegistry
orButler
is initialized with this struct.- run
str
, optional Name of the
RUN
collection new datasets should be inserted into. Ifcollections
isNone
andrun
is notNone
,collections
will be set to[run]
. If notNone
, this collection will automatically be registered when the default struct is attached to aRegistry
instance.- infer
bool
, optional If
True
(default) infer default data ID values from the values present in the datasets incollections
: if all collections have the same value (or no value) for a governor dimension, that value will be the default for that dimension. Nonexistent collections are ignored. If a default value is provided explicitly for a governor dimension via**kwargs
, no default will be inferred for that dimension.- **kwargs
str
Default data ID key-value pairs. These may only identify “governor” dimensions like
instrument
andskymap
, though this is only checked when the defaults struct is actually attached to aRegistry
.
- collections
Methods Summary
clone
([collections, run, inferDefaults, dataId])Make a copy of this RegistryDefaults object, optionally modifying values.
finish
(registry)Validate the defaults struct and standardize its data ID.
from_butler_instance_options
(options)Create a
RegistryDefaults
object from the values specified by aButlerInstanceOptions
object.from_data_id
(data_id)Create a RegistryDefaults object with a specified
dataId
value and no default collections.Methods Documentation
- clone(collections: CollectionArgType | None | EllipsisType = Ellipsis, run: str | None | EllipsisType = Ellipsis, inferDefaults: bool | EllipsisType = Ellipsis, dataId: dict[str, str] | EllipsisType = Ellipsis) RegistryDefaults ¶
Make a copy of this RegistryDefaults object, optionally modifying values.
- Parameters:
- collections
CollectionArgType
orNone
, optional Same as constructor. If omitted, uses value from original object.
- run
str
orNone
, optional Same as constructor. If
None
, no default run is used. If omitted, copies value from original object.- inferDefaults
bool
, optional Same as constructor. If omitted, copies value from original object.
- dataId
dict
[str
,str
] Same as
kwargs
arguments to constructor. If omitted, copies values from original object.
- collections
- Returns:
- defaults
RegistryDefaults
New instance if any changes were made, otherwise the original instance.
- defaults
Notes
finish()
must be called on the returned object to complete initialization.
- finish(registry: Registry | SqlRegistry) None ¶
Validate the defaults struct and standardize its data ID.
This should be called only by a
Registry
instance when the defaults struct is first associated with it.- Parameters:
- registry
Registry
Registry instance these defaults are being attached to.
- registry
- Raises:
- TypeError
Raised if a non-governor dimension was included in
**kwargs
at construction.
- static from_butler_instance_options(options: ButlerInstanceOptions) RegistryDefaults ¶
Create a
RegistryDefaults
object from the values specified by aButlerInstanceOptions
object.- Parameters:
- options
ButlerInstanceOptions
Butler options object.
- options
- static from_data_id(data_id: DataCoordinate) RegistryDefaults ¶
Create a RegistryDefaults object with a specified
dataId
value and no default collections.- Parameters:
- data_id
DataCoordinate
The default data ID value.
- data_id