DimensionConfig¶
- 
class lsst.daf.butler.DimensionConfig(other: Union[str, urllib.parse.ParseResult, lsst.resources._resourcePath.ResourcePath, pathlib.Path, lsst.daf.butler.core.config.Config, None] = None, validate: bool = True, searchPaths: Optional[Iterable[Union[str, urllib.parse.ParseResult, lsst.resources._resourcePath.ResourcePath, pathlib.Path]], None] = None)¶
- Bases: - lsst.daf.butler.ConfigSubset- Configuration that defines a - DimensionUniverse.- The configuration tree for dimensions is a (nested) dictionary with five top-level entries: - version: an integer version number, used as keys in a singleton registry
of all DimensionUniverseinstances;
- namespace: a string to be associated with the version in the singleton
registry of all DimensionUniversinstances;
- skypix: a dictionary whose entries each define a SkyPixSystem, along with a special “common” key whose value is the name of a skypix dimension that is used to relate all other spatial dimensions in theRegistrydatabase;
- elements: a nested dictionary whose entries each define
StandardDimensionorStandardDimensionCombination.
- topology: a nested dictionary with spatialandtemporalkeys, with dictionary values that each define aStandardTopologicalFamily.
- packers: a nested dictionary whose entries define factories for a
DimensionPackerinstance.
 - See the documentation for the linked classes above for more information on the configuration syntax. - Parameters: - other : Configorstrordict, optional
- Argument specifying the configuration information as understood by - Config. If- Noneis passed then defaults are loaded from “dimensions.yaml”, otherwise defaults are not loaded.
- validate : bool, optional
- If - Truerequired keys will be checked to ensure configuration consistency.
- searchPaths : listortuple, optional
- Explicit additional paths to search for defaults. They should be supplied in priority order. These paths have higher priority than those read from the environment in - ConfigSubset.defaultSearchPaths(). Paths can be- strreferring to the local file system or URIs,- lsst.resources.ResourcePath.
 - Attributes Summary - component- defaultConfigFile- includeKey- requiredKeys- resourcesPackage- Methods Summary - asArray(name)- Get a value as an array. - clear()- copy()- defaultSearchPaths()- Read environment to determine search paths to use. - dump(output, None] = None, format)- Write the config to an output stream. - dumpToUri(uri, urllib.parse.ParseResult, …)- Write the config to location pointed to by given URI. - fromString(string, format)- Create a new Config instance from a serialized string. - fromYaml(string)- Create a new Config instance from a YAML string. - get(k[,d])- items()- keys()- makeBuilder()- Construct a - DinmensionConstructionBuilder.- merge(other)- Merge another Config into this one. - nameTuples([topLevelOnly])- Get tuples representing the name hierarchies of all keys. - names([topLevelOnly, delimiter])- Get a delimited name of all the keys in the hierarchy. - pop(k[,d])- If key is not found, d is returned if given, otherwise KeyError is raised. - popitem()- as a 2-tuple; but raise KeyError if D is empty. - ppprint()- Return config as formatted readable string. - setdefault(k[,d])- toDict()- Convert a - Configto a standalone hierarchical- dict.- update(other)- Update config from other - Configor- dict.- updateParameters(configType, config, full[, …])- Update specific config parameters. - validate()- Check that mandatory keys are present in this configuration. - values()- Attributes Documentation - 
component= None¶
 - 
defaultConfigFile= 'dimensions.yaml'¶
 - 
includeKey= 'includeConfigs'¶
 - 
requiredKeys= ('version', 'elements', 'skypix')¶
 - 
resourcesPackage= 'lsst.daf.butler'¶
 - Methods Documentation - 
asArray(name)¶
- Get a value as an array. - May contain one or more elements. - Parameters: - name : str
- Key to use to retrieve value. 
 - Returns: - array : collections.abc.Sequence
- The value corresponding to name, but guaranteed to be returned as a list with at least one element. If the value is a - Sequence(and not a- str) the value itself will be returned, else the value will be the first element.
 
- name : 
 - 
clear() → None. Remove all items from D.¶
 - 
copy()¶
 - 
classmethod defaultSearchPaths()¶
- Read environment to determine search paths to use. - Global defaults, at lowest priority, are found in the - configdirectory of the butler source tree. Additional defaults can be defined using the environment variable- $DAF_BUTLER_CONFIG_PATHSwhich is a PATH-like variable where paths at the front of the list have priority over those later.- Returns: - paths : list
- Returns a list of paths to search. The returned order is in priority with the highest priority paths first. The butler config configuration resources will not be included here but will always be searched last. 
 - Notes - The environment variable is split on the standard - :path separator. This currently makes it incompatible with usage of URIs.
- paths : 
 - 
dump(output: Optional[IO, None] = None, format: str = 'yaml') → Optional[str, None]¶
- Write the config to an output stream. - Parameters: - Returns: 
 - 
dumpToUri(uri: Union[str, urllib.parse.ParseResult, lsst.resources._resourcePath.ResourcePath, pathlib.Path], updateFile: bool = True, defaultFileName: str = 'butler.yaml', overwrite: bool = True) → None¶
- Write the config to location pointed to by given URI. - Currently supports ‘s3’ and ‘file’ URI schemes. - Parameters: - uri: `lsst.resources.ResourcePathExpression`
- URI of location where the Config will be written. 
- updateFile : bool, optional
- If True and uri does not end on a filename with extension, will append - defaultFileNameto the target uri. True by default.
- defaultFileName : bool, optional
- The file name that will be appended to target uri if updateFile is True and uri does not end on a file with an extension. 
- overwrite : bool, optional
- If True the configuration will be written even if it already exists at that location. 
 
 - 
classmethod fromString(string: str, format: str = 'yaml') → lsst.daf.butler.core.config.Config¶
- Create a new Config instance from a serialized string. - Parameters: - Returns: - c : Config
- Newly-constructed Config. 
 
- c : 
 - 
classmethod fromYaml(string: str) → lsst.daf.butler.core.config.Config¶
- Create a new Config instance from a YAML string. - Parameters: - string : str
- String containing content in YAML format 
 - Returns: - c : Config
- Newly-constructed Config. 
 
- string : 
 - 
get(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
 - 
items() → a set-like object providing a view on D's items¶
 - 
keys() → a set-like object providing a view on D's keys¶
 - 
makeBuilder() → lsst.daf.butler.core.dimensions.construction.DimensionConstructionBuilder¶
- Construct a - DinmensionConstructionBuilder.- The builder will reflect this configuration. - Returns: - builder : DimensionConstructionBuilder
- A builder object populated with all visitors from this configuration. The - finishmethod will not have been called.
 
- builder : 
 - 
merge(other)¶
- Merge another Config into this one. - Like - Config.update(), but will add keys & values from other that DO NOT EXIST in self.- Keys and values that already exist in self will NOT be overwritten. - Parameters: 
 - 
nameTuples(topLevelOnly=False)¶
- Get tuples representing the name hierarchies of all keys. - The tuples returned from this method are guaranteed to be usable to access items in the configuration object. - Parameters: - topLevelOnly : bool, optional
- If False, the default, a full hierarchy of names is returned. If True, only the top level are returned. 
 - Returns: 
- topLevelOnly : 
 - 
names(topLevelOnly=False, delimiter=None)¶
- Get a delimited name of all the keys in the hierarchy. - The values returned from this method are guaranteed to be usable to access items in the configuration object. - Parameters: - topLevelOnly : bool, optional
- If False, the default, a full hierarchy of names is returned. If True, only the top level are returned. 
- delimiter : str, optional
- Delimiter to use when forming the keys. If the delimiter is present in any of the keys, it will be escaped in the returned names. If - Nonegiven a delimiter will be automatically provided. The delimiter can not be alphanumeric.
 - Returns: - Raises: - ValueError:
- The supplied delimiter is alphanumeric. 
 - Notes - This is different than the built-in method - dict.keys, which will return only the first level keys.
- topLevelOnly : 
 - 
pop(k[, d]) → v, remove specified key and return the corresponding value.¶
- If key is not found, d is returned if given, otherwise KeyError is raised. 
 - 
popitem() → (k, v), remove and return some (key, value) pair¶
- as a 2-tuple; but raise KeyError if D is empty. 
 - 
ppprint()¶
- Return config as formatted readable string. - Returns: - s : str
- A prettyprint formatted string representing the config 
 - Examples - use: - pdb> print(myConfigObject.ppprint())
- s : 
 - 
setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
 - 
toDict()¶
- Convert a - Configto a standalone hierarchical- dict.- Returns: - Notes - This can be useful when passing a Config to some code that expects native Python types. 
 - 
update(other)¶
- Update config from other - Configor- dict.- Like - dict.update(), but will add or modify keys in nested dicts, instead of overwriting the nested dict entirely.- Parameters: - Examples - >>> c = Config({"a": {"b": 1}}) >>> c.update({"a": {"c": 2}}) >>> print(c) {'a': {'b': 1, 'c': 2}} - >>> foo = {"a": {"b": 1}} >>> foo.update({"a": {"c": 2}}) >>> print(foo) {'a': {'c': 2}} 
 - 
static updateParameters(configType, config, full, toUpdate=None, toCopy=None, overwrite=True, toMerge=None)¶
- Update specific config parameters. - Allows for named parameters to be set to new values in bulk, and for other values to be set by copying from a reference config. - Assumes that the supplied config is compatible with - configTypeand will attach the updated values to the supplied config by looking for the related component key. It is assumed that- configand- fullare from the same part of the configuration hierarchy.- Parameters: - configType : ConfigSubset
- Config type to use to extract relevant items from - config.
- config : Config
- A - Configto update. Only the subset understood by the supplied- ConfigSubsetwill be modified. Default values will not be inserted and the content will not be validated since mandatory keys are allowed to be missing until populated later by merging.
- full : Config
- A complete config with all defaults expanded that can be converted to a - configType. Read-only and will not be modified by this method. Values are read from here if- toCopyis defined.- Repository-specific options that should not be obtained from defaults when Butler instances are constructed should be copied from - fullto- config.
- toUpdate : dict, optional
- A - dictdefining the keys to update and the new value to use. The keys and values can be any supported by- Configassignment.
- toCopy : tuple, optional
- tupleof keys whose values should be copied from- fullinto- config.
- overwrite : bool, optional
- If - False, do not modify a value in- configif the key already exists. Default is always to overwrite.
- toMerge : tuple, optional
- Keys to merge content from full to config without overwriting pre-existing values. Only works if the key refers to a hierarchy. The - overwriteflag is ignored.
 - Raises: - ValueError
- Neither - toUpdate,- toCopynor- toMergewere defined.
 
- configType : 
 - 
validate()¶
- Check that mandatory keys are present in this configuration. - Ignored if - requiredKeysis empty.
 - 
values() → an object providing a view on D's values¶
 
- version: an integer version number, used as keys in a singleton registry
of all