|
LSST Applications g00274db5b6+edbf708997,g00d0e8bbd7+edbf708997,g199a45376c+5137f08352,g1fd858c14a+1d4b6db739,g262e1987ae+f4d9505c4f,g29ae962dfc+7156fb1a53,g2cef7863aa+73c82f25e4,g35bb328faa+edbf708997,g3e17d7035e+5b3adc59f5,g3fd5ace14f+852fa6fbcb,g47891489e3+6dc8069a4c,g53246c7159+edbf708997,g64539dfbff+9f17e571f4,g67b6fd64d1+6dc8069a4c,g74acd417e5+ae494d68d9,g786e29fd12+af89c03590,g7ae74a0b1c+a25e60b391,g7aefaa3e3d+536efcc10a,g7cc15d900a+d121454f8d,g87389fa792+a4172ec7da,g89139ef638+6dc8069a4c,g8d7436a09f+28c28d8d6d,g8ea07a8fe4+db21c37724,g92c671f44c+9f17e571f4,g98df359435+b2e6376b13,g99af87f6a8+b0f4ad7b8d,gac66b60396+966efe6077,gb88ae4c679+7dec8f19df,gbaa8f7a6c5+38b34f4976,gbf99507273+edbf708997,gc24b5d6ed1+9f17e571f4,gca7fc764a6+6dc8069a4c,gcc769fe2a4+97d0256649,gd7ef33dd92+6dc8069a4c,gdab6d2f7ff+ae494d68d9,gdbb4c4dda9+9f17e571f4,ge410e46f29+6dc8069a4c,geaed405ab2+e194be0d2b,w.2025.47
LSST Data Management Base Package
|
Public Member Functions | |
| __init__ (self, doc, typemap, default=None, optional=False, multi=False, deprecated=None) | |
| __class_getitem__ (cls, tuple[type,...]|type|ForwardRef params) | |
| ConfigChoiceField | __get__ (self, None instance, Any owner=None, Any at=None, str label="default") |
| ConfigInstanceDict | __get__ (self, Config instance, Any owner=None, Any at=None, str label="default") |
| __get__ (self, instance, owner=None, at=None, label="default") | |
| None | __set__ (self, Config instance, ConfigInstanceDict|None value, Any at=None, str label="assignment") |
| rename (self, instance) | |
| validate (self, instance) | |
| toDict (self, instance) | |
| freeze (self, instance) | |
| save (self, outfile, instance) | |
| __deepcopy__ (self, memo) | |
| __delete__ (self, instance, at=None, label="deletion") | |
| types (self) | |
| __contains__ (self, k) | |
| __len__ (self) | |
| __iter__ (self) | |
| __getitem__ (self, k, at=None, label="default") | |
| __setitem__ (self, k, value, at=None, label="assignment") | |
| __setattr__ (self, attr, value, at=None, label="assignment") | |
| __reduce__ (self) | |
| keys (self) | |
| values (self) | |
| items (self) | |
| __new__ (cls, *args, **kw) | |
| Config | copy (self) |
| setDefaults (self) | |
| update (self, **kw) | |
| load (self, filename, root="config") | |
| loadFromStream (self, stream, root="config", filename=None, extraLocals=None) | |
| loadFromString (self, code, root="config", filename=None, extraLocals=None) | |
| saveToString (self, skipImports=False) | |
| saveToStream (self, outfile, root="config", skipImports=False) | |
| formatHistory (self, name, **kwargs) | |
| __delattr__ (self, attr, at=None, label="deletion") | |
| __eq__ (self, other) | |
| __ne__ (self, other) | |
| __str__ (self) | |
| __repr__ (self) | |
| compare (self, other, shortcut=True, rtol=1e-8, atol=1e-8, output=None) | |
| __init_subclass__ (cls, **kwargs) | |
Public Attributes | |
| typemap = typemap | |
| multi = multi | |
| dtype = dtype | |
| doc = doc | |
| deprecated = deprecated | |
| default = default | |
| check = check | |
| optional = optional | |
| source = source | |
| types | |
Static Public Attributes | |
| instanceDictClass = ConfigInstanceDict | |
| dict | supportedTypes = {str, bool, float, int, complex} |
Protected Member Functions | |
| _getOrMake (self, instance, label="default") | |
| Any | _copy_storage (self, Config old, Config new) |
| _collectImports (self, instance, imports) | |
| _compare (self, instance1, instance2, shortcut, rtol, atol, output) | |
| _setup (self, doc, dtype, default, check, optional, source, deprecated) | |
| _validateValue (self, value) | |
| ConfigInstanceDict | _copy (self, Config config) |
| _setSelection (self, value, at=None, label="assignment") | |
| _getNames (self) | |
| _setNames (self, value) | |
| _delNames (self) | |
| _getName (self) | |
| _setName (self, value) | |
| _delName (self) | |
| _getActive (self) | |
| _rename (self, fullname) | |
| _save (self, outfile) | |
| _fromPython (cls, config_py) | |
Static Protected Member Functions | |
| Mapping[str, Any] | _parseTypingArgs (tuple[type,...]|tuple[str,...] params, Mapping[str, Any] kwds) |
Protected Attributes | |
| dict | _dict = {} |
| _selection = None | |
| _config = config | |
| _field = field | |
| _typemap = None | |
| bool | _frozen = True |
| _name = name | |
| dict | _fields = {} |
| _source = getStackFrame() | |
Static Protected Attributes | |
| dict | _storage [str, Any] |
| dict | _history [str, list[Any]] |
| set | _imports [Any] |
Properties | |
| names = property(_getNames, _setNames, _delNames) | |
| name = property(_getName, _setName, _delName) | |
| active = property(_getActive) | |
| history = property(lambda x: x._history) | |
A configuration field (`~lsst.pex.config.Field` subclass) that allows a
user to choose from a set of `~lsst.pex.config.Config` types.
Parameters
----------
doc : `str`
Documentation string for the field.
typemap : `dict`-like
A mapping between keys and `~lsst.pex.config.Config`-types as values.
See *Examples* for details.
default : `str`, optional
The default configuration name.
optional : `bool`, optional
When `False`, `lsst.pex.config.Config.validate` will fail if the
field's value is `None`.
multi : `bool`, optional
If `True`, the field allows multiple selections. In this case, set the
selections by assigning a sequence to the ``names`` attribute of the
field.
If `False`, the field allows only a single selection. In this case,
set the active config by assigning the config's key from the
``typemap`` to the field's ``name`` attribute (see *Examples*).
deprecated : None or `str`, optional
A description of why this Field is deprecated, including removal date.
If not None, the string is appended to the docstring for this Field.
See Also
--------
ChoiceField
ConfigDictField
ConfigField
ConfigurableField
DictField
Field
ListField
RangeField
RegistryField
Notes
-----
``ConfigChoiceField`` instances can allow either single selections or
multiple selections, depending on the ``multi`` parameter. For
single-selection fields, set the selection with the ``name`` attribute.
For multi-selection fields, set the selection though the ``names``
attribute.
This field is validated only against the active selection. If the
``active`` attribute is `None` and the field is not optional, validation
will fail.
When saving a configuration with a ``ConfigChoiceField``, the entire set is
saved, as well as the active selection.
Examples
--------
While the ``typemap`` is shared by all instances of the field, each
instance of the field has its own instance of a particular sub-config type.
For example, ``AaaConfig`` is a config object
>>> from lsst.pex.config import Config, ConfigChoiceField, Field
>>> class AaaConfig(Config):
... somefield = Field("doc", int)
The ``MyConfig`` config has a ``ConfigChoiceField`` field called ``choice``
that maps the ``AaaConfig`` type to the ``"AAA"`` key:
>>> TYPEMAP = {"AAA", AaaConfig}
>>> class MyConfig(Config):
... choice = ConfigChoiceField("doc for choice", TYPEMAP)
Creating an instance of ``MyConfig``:
>>> instance = MyConfig()
Setting value of the field ``somefield`` on the "AAA" key of the ``choice``
field:
>>> instance.choice["AAA"].somefield = 5
**Selecting the active configuration**
Make the ``"AAA"`` key the active configuration value for the ``choice``
field:
>>> instance.choice = "AAA"
Alternatively, the last line can be written:
>>> instance.choice.name = "AAA"
(If the config instance allows multiple selections, you'd assign a sequence
to the ``names`` attribute instead.)
``ConfigChoiceField`` instances also allow multiple values of the same
type:
>>> TYPEMAP["CCC"] = AaaConfig
>>> TYPEMAP["BBB"] = AaaConfig
Definition at line 391 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.__init__ | ( | self, | |
| doc, | |||
| typemap, | |||
| default = None, | |||
| optional = False, | |||
| multi = False, | |||
| deprecated = None ) |
Definition at line 496 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.__class_getitem__ | ( | cls, | |
| tuple[type, ...] | type | ForwardRef | params ) |
Definition at line 510 of file configChoiceField.py.
|
inherited |
Definition at line 204 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.__deepcopy__ | ( | self, | |
| memo ) |
Customize deep-copying, because we always want a reference to the original typemap. WARNING: this must be overridden by subclasses if they change the constructor signature!
Definition at line 619 of file configChoiceField.py.
|
inherited |
|
inherited |
Delete an attribute from a `lsst.pex.config.Config` instance.
Parameters
----------
instance : `lsst.pex.config.Config`
The config instance that contains this field.
at : `list` of `lsst.pex.config.callStack.StackFrame`
The call stack (created by
`lsst.pex.config.callStack.getCallStack`).
label : `str`, optional
Event label for the history.
Notes
-----
This is invoked by the owning `~lsst.pex.config.Config` object and
should not be called directly.
Definition at line 808 of file config.py.
|
inherited |
Definition at line 1625 of file config.py.
| ConfigInstanceDict lsst.pex.config.configChoiceField.ConfigChoiceField.__get__ | ( | self, | |
| Config | instance, | ||
| Any | owner = None, | ||
| Any | at = None, | ||
| str | label = "default" ) |
Definition at line 531 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.__get__ | ( | self, | |
| instance, | |||
| owner = None, | |||
| at = None, | |||
| label = "default" ) |
Definition at line 535 of file configChoiceField.py.
| ConfigChoiceField lsst.pex.config.configChoiceField.ConfigChoiceField.__get__ | ( | self, | |
| None | instance, | ||
| Any | owner = None, | ||
| Any | at = None, | ||
| str | label = "default" ) |
Definition at line 526 of file configChoiceField.py.
|
inherited |
Definition at line 300 of file configChoiceField.py.
|
inherited |
Run initialization for every subclass. Specifically registers the subclass with a YAML representer and YAML constructor (if pyyaml is available)
Definition at line 1694 of file config.py.
|
inherited |
Definition at line 210 of file configChoiceField.py.
|
inherited |
Definition at line 207 of file configChoiceField.py.
|
inherited |
|
inherited |
Allocate a new `lsst.pex.config.Config` object. In order to ensure that all Config object are always in a proper state when handed to users or to derived `~lsst.pex.config.Config` classes, some attributes are handled at allocation time rather than at initialization. This ensures that even if a derived `~lsst.pex.config.Config` class implements ``__init__``, its author does not need to be concerned about when or even the base ``Config.__init__`` should be called.
Definition at line 1033 of file config.py.
|
inherited |
Definition at line 383 of file configChoiceField.py.
|
inherited |
| None lsst.pex.config.configChoiceField.ConfigChoiceField.__set__ | ( | self, | |
| Config | instance, | ||
| ConfigInstanceDict | None | value, | ||
| Any | at = None, | ||
| str | label = "assignment" ) |
Definition at line 541 of file configChoiceField.py.
|
inherited |
Definition at line 351 of file configChoiceField.py.
|
inherited |
Definition at line 317 of file configChoiceField.py.
|
inherited |
|
protected |
Call the _collectImports method on all config
objects the field may own, and union them with the supplied imports
set.
Parameters
----------
instance : instance or subclass of `lsst.pex.config.Config`
A config object that has this field defined on it
imports : `set`
Set of python modules that need imported after persistence
Reimplemented from lsst.pex.config.config.Field.
Definition at line 603 of file configChoiceField.py.
|
protected |
Compare two fields for equality.
Used by `lsst.pex.ConfigChoiceField.compare`.
Parameters
----------
instance1 : `lsst.pex.config.Config`
Left-hand side config instance to compare.
instance2 : `lsst.pex.config.Config`
Right-hand side config instance to compare.
shortcut : `bool`
If `True`, this function returns as soon as an inequality if found.
rtol : `float`
Relative tolerance for floating point comparisons.
atol : `float`
Absolute tolerance for floating point comparisons.
output : callable
A callable that takes a string, used (possibly repeatedly) to
report inequalities.
Returns
-------
isEqual : bool
`True` if the fields are equal, `False` otherwise.
Notes
-----
Only the selected configurations are compared, as the parameters of any
others do not matter.
Floating point comparisons are performed by `numpy.allclose`.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 636 of file configChoiceField.py.
|
protectedinherited |
Definition at line 188 of file configChoiceField.py.
|
protected |
Copy the storage for this field in the given field into an object suitable for storage in a new copy of that config. Any frozen storage should be unfrozen.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 557 of file configChoiceField.py.
|
protectedinherited |
Definition at line 265 of file configChoiceField.py.
|
protectedinherited |
Definition at line 244 of file configChoiceField.py.
|
protectedinherited |
Instantiate a `Config`-subclass from serialized Python form.
Parameters
----------
config_py : `str`
A serialized form of the Config as created by
`Config.saveToStream`.
Returns
-------
config : `Config`
Reconstructed `Config` instant.
Definition at line 1708 of file config.py.
|
protectedinherited |
Definition at line 284 of file configChoiceField.py.
|
protectedinherited |
Definition at line 251 of file configChoiceField.py.
|
protectedinherited |
Definition at line 230 of file configChoiceField.py.
|
protected |
Definition at line 513 of file configChoiceField.py.
|
staticprotectedinherited |
Parse type annotations into keyword constructor arguments.
This is a special private method that interprets type arguments (i.e.
Field[str]) into keyword arguments to be passed on to the constructor.
Subclasses of Field can implement this method to customize how they
handle turning type parameters into keyword arguments (see DictField
for an example)
Parameters
----------
params : `tuple` of `type` or `tuple` of str
Parameters passed to the type annotation. These will either be
types or strings. Strings are to interpreted as forward references
and will be treated as such.
kwds : `MutableMapping` with keys of `str` and values of `Any`
These are the user supplied keywords that are to be passed to the
Field constructor.
Returns
-------
kwds : `MutableMapping` with keys of `str` and values of `Any`
The mapping of keywords that will be passed onto the constructor
of the Field. Should be filled in with any information gleaned
from the input parameters.
Raises
------
ValueError
Raised if params is of incorrect length.
Raised if a forward reference could not be resolved
Raised if there is a conflict between params and values in kwds
Reimplemented in lsst.pex.config.configurableField.ConfigurableField, and lsst.pex.config.dictField.DictField.
Definition at line 410 of file config.py.
|
protectedinherited |
Rename this config object in its parent `~lsst.pex.config.Config`.
Parameters
----------
name : `str`
New name for this config in its parent `~lsst.pex.config.Config`.
Notes
-----
This method uses the `~lsst.pex.config.Field.rename` method of
individual `lsst.pex.config.Field` instances.
`lsst.pex.config.Field` subclasses may need to implement a ``rename``
method for *this* method to work.
See Also
--------
lsst.pex.config.Field.rename
Reimplemented from lsst.pex.config.config.Config.
Definition at line 347 of file configChoiceField.py.
|
protectedinherited |
Save this config to an open stream object.
Parameters
----------
outfile : file-like object
Destination file object write the config into. Accepts strings not
bytes.
Definition at line 1426 of file config.py.
|
protectedinherited |
Definition at line 258 of file configChoiceField.py.
|
protectedinherited |
Definition at line 237 of file configChoiceField.py.
|
protectedinherited |
Definition at line 213 of file configChoiceField.py.
|
protectedinherited |
Set attributes, usually during initialization.
Definition at line 486 of file config.py.
|
protectedinherited |
Validate a value.
Parameters
----------
value : object
The value being validated.
Raises
------
TypeError
Raised if the value's type is incompatible with the field's
``dtype``.
ValueError
Raised if the value is rejected by the ``check`` method.
Reimplemented in lsst.pex.config.choiceField.ChoiceField, and lsst.pex.config.rangeField.RangeField.
Definition at line 598 of file config.py.
|
inherited |
Compare this configuration to another `~lsst.pex.config.Config` for
equality.
Parameters
----------
other : `lsst.pex.config.Config`
Other `~lsst.pex.config.Config` object to compare against this
config.
shortcut : `bool`, optional
If `True`, return as soon as an inequality is found. Default is
`True`.
rtol : `float`, optional
Relative tolerance for floating point comparisons.
atol : `float`, optional
Absolute tolerance for floating point comparisons.
output : callable, optional
A callable that takes a string, used (possibly repeatedly) to
report inequalities.
Returns
-------
isEqual : `bool`
`True` when the two `lsst.pex.config.Config` instances are equal.
`False` if there is an inequality.
See Also
--------
lsst.pex.config.compareConfigs
Notes
-----
Unselected targets of `~lsst.pex.config.RegistryField` fields and
unselected choices of `~lsst.pex.config.ConfigChoiceField` fields
are not considered by this method.
Floating point comparisons are performed by `numpy.allclose`.
Definition at line 1650 of file config.py.
|
inherited |
Return a deep copy of this config. Notes ----- The returned config object is not frozen, even if the original was. If a nested config object is copied, it retains the name from its original hierarchy. Nested objects are only shared between the new and old configs if they are not possible to modify via the config's interfaces (e.g. entries in the the history list are not copied, but the lists themselves are, so modifications to one copy do not modify the other).
Reimplemented in lsst.pex.config.configurableActions._configurableAction.ConfigurableAction.
Definition at line 1066 of file config.py.
|
inherited |
Format a configuration field's history to a human-readable format.
Parameters
----------
name : `str`
Name of a `~lsst.pex.config.Field` in this config.
**kwargs
Keyword arguments passed to `lsst.pex.config.history.format`.
Returns
-------
history : `str`
A string containing the formatted history.
See Also
--------
lsst.pex.config.history.format
Definition at line 1555 of file config.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.freeze | ( | self, | |
| instance ) |
Make this field read-only (for internal use only).
Parameters
----------
instance : `lsst.pex.config.Config`
The config instance that contains this field.
Notes
-----
Freezing is only relevant for fields that hold subconfigs. Fields which
hold subconfigs should freeze each subconfig.
**Subclasses should implement this method.**
Reimplemented from lsst.pex.config.config.Field.
Definition at line 597 of file configChoiceField.py.
|
inherited |
Get configurations as ``(field name, field value)`` pairs.
Returns
-------
items : `~collections.abc.ItemsView`
Iterator of tuples for each configuration. Tuple items are:
0. Field name.
1. Field value.
Definition at line 1005 of file config.py.
|
inherited |
Get field names.
Returns
-------
names : `~collections.abc.KeysView`
List of `lsst.pex.config.Field` names.
Definition at line 985 of file config.py.
|
inherited |
Modify this config in place by executing the Python code in a
configuration file.
Parameters
----------
filename : `str`
Name of the configuration file. A configuration file is Python
module.
root : `str`, optional
Name of the variable in file that refers to the config being
overridden.
For example, the value of root is ``"config"`` and the file
contains::
config.myField = 5
Then this config's field ``myField`` is set to ``5``.
See Also
--------
lsst.pex.config.Config.loadFromStream
lsst.pex.config.Config.loadFromString
lsst.pex.config.Config.save
lsst.pex.config.Config.saveToStream
lsst.pex.config.Config.saveToString
Definition at line 1174 of file config.py.
|
inherited |
Modify this Config in place by executing the Python code in the
provided stream.
Parameters
----------
stream : file-like object, `str`, `bytes`, or `~types.CodeType`
Stream containing configuration override code. If this is a
code object, it should be compiled with ``mode="exec"``.
root : `str`, optional
Name of the variable in file that refers to the config being
overridden.
For example, the value of root is ``"config"`` and the file
contains::
config.myField = 5
Then this config's field ``myField`` is set to ``5``.
filename : `str`, optional
Name of the configuration file, or `None` if unknown or contained
in the stream. Used for error reporting.
extraLocals : `dict` of `str` to `object`, optional
Any extra variables to include in local scope when loading.
Notes
-----
For backwards compatibility reasons, this method accepts strings, bytes
and code objects as well as file-like objects. New code should use
`loadFromString` instead for most of these types.
See Also
--------
lsst.pex.config.Config.load
lsst.pex.config.Config.loadFromString
lsst.pex.config.Config.save
lsst.pex.config.Config.saveToStream
lsst.pex.config.Config.saveToString
Definition at line 1206 of file config.py.
|
inherited |
Modify this Config in place by executing the Python code in the
provided string.
Parameters
----------
code : `str`, `bytes`, or `~types.CodeType`
Stream containing configuration override code.
root : `str`, optional
Name of the variable in file that refers to the config being
overridden.
For example, the value of root is ``"config"`` and the file
contains::
config.myField = 5
Then this config's field ``myField`` is set to ``5``.
filename : `str`, optional
Name of the configuration file, or `None` if unknown or contained
in the stream. Used for error reporting.
extraLocals : `dict` of `str` to `object`, optional
Any extra variables to include in local scope when loading.
Raises
------
ValueError
Raised if a key in extraLocals is the same value as the value of
the root argument.
See Also
--------
lsst.pex.config.Config.load
lsst.pex.config.Config.loadFromStream
lsst.pex.config.Config.save
lsst.pex.config.Config.saveToStream
lsst.pex.config.Config.saveToString
Definition at line 1253 of file config.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.rename | ( | self, | |
| instance ) |
Rename the field in a `~lsst.pex.config.Config` (for internal use
only).
Parameters
----------
instance : `lsst.pex.config.Config`
The config instance that contains this field.
Notes
-----
This method is invoked by the `lsst.pex.config.Config` object that
contains this field and should not be called directly.
Renaming is only relevant for `~lsst.pex.config.Field` instances that
hold subconfigs. `~lsst.pex.config.Field`\s that hold subconfigs should
rename each subconfig with the full field name as generated by
`lsst.pex.config.config._joinNamePath`.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 564 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.save | ( | self, | |
| outfile, | |||
| instance ) |
Save this field to a file (for internal use only).
Parameters
----------
outfile : file-like object
A writeable field handle.
instance : `~lsst.pex.config.Config`
The `~lsst.pex.config.Config` instance that contains this field.
Notes
-----
This method is invoked by the `~lsst.pex.config.Config` object that
contains this field and should not be called directly.
The output consists of the documentation string
(`lsst.pex.config.Field.doc`) formatted as a Python comment. The second
line is formatted as an assignment: ``{fullname}={value}``.
This output can be executed with Python.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 609 of file configChoiceField.py.
|
inherited |
Save a configuration file to a stream, which, when loaded,
reproduces this config.
Parameters
----------
outfile : file-like object
Destination file object write the config into. Accepts strings not
bytes.
root : `str`, optional
Name to use for the root config variable. The same value must be
used when loading (see `lsst.pex.config.Config.load`).
skipImports : `bool`, optional
If `True` then do not include ``import`` statements in output,
this is to support human-oriented output from ``pipetask`` where
additional clutter is not useful.
See Also
--------
lsst.pex.config.Config.save
lsst.pex.config.Config.saveToString
lsst.pex.config.Config.load
lsst.pex.config.Config.loadFromStream
lsst.pex.config.Config.loadFromString
Definition at line 1371 of file config.py.
|
inherited |
Return the Python script form of this configuration as an executable
string.
Parameters
----------
skipImports : `bool`, optional
If `True` then do not include ``import`` statements in output,
this is to support human-oriented output from ``pipetask`` where
additional clutter is not useful.
Returns
-------
code : `str`
A code string readable by `loadFromString`.
See Also
--------
lsst.pex.config.Config.save
lsst.pex.config.Config.saveToStream
lsst.pex.config.Config.load
lsst.pex.config.Config.loadFromStream
lsst.pex.config.Config.loadFromString
Definition at line 1343 of file config.py.
|
inherited |
Subclass hook for computing defaults. Notes ----- Derived `~lsst.pex.config.Config` classes that must compute defaults rather than using the `~lsst.pex.config.Field` instances's defaults should do so here. To correctly use inherited defaults, implementations of ``setDefaults`` must call their base class's ``setDefaults``.
Reimplemented in lsst.pipe.tasks.background.MaskObjectsConfig, lsst.pipe.tasks.dataFrameActions._actions.NanoJansky, lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverConfig, lsst.ip.diffim.dipoleMeasurement.DipoleMeasurementConfig, lsst.ip.diffim.subtractImages.AlardLuptonSubtractBaseConfig, lsst.ip.isr.ampOffset.AmpOffsetConfig, lsst.meas.algorithms.computeExPsf.ComputeExPsfConfig, lsst.meas.algorithms.measureApCorr.MeasureApCorrConfig, lsst.meas.algorithms.noise_covariance.ComputeNoiseCorrelationConfig, lsst.meas.algorithms.normalizedCalibrationFlux.NormalizedCalibrationFluxConfig, lsst.meas.algorithms.scaleVariance.ScaleVarianceConfig, lsst.meas.base.forcedMeasurement.ForcedMeasurementConfig, lsst.meas.base.simple_forced_measurement.SimpleForcedMeasurementConfig, lsst.meas.modelfit.cmodel.cmodelContinued.CModelForcedConfig, lsst.meas.modelfit.cmodel.cmodelContinued.CModelSingleFrameConfig, lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxForcedConfig, and lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxSingleFrameConfig.
Definition at line 1103 of file config.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.toDict | ( | self, | |
| instance ) |
Convert the field value so that it can be set as the value of an
item in a `dict` (for internal use only).
Parameters
----------
instance : `~lsst.pex.config.Config`
The `~lsst.pex.config.Config` that contains this field.
Returns
-------
value : object
The field's value. See *Notes*.
Notes
-----
This method invoked by the owning `~lsst.pex.config.Config` object and
should not be called directly.
Simple values are passed through. Complex data structures must be
manipulated. For example, a `~lsst.pex.config.Field` holding a
subconfig should, instead of the subconfig object, return a `dict`
where the keys are the field names in the subconfig, and the values are
the field values in the subconfig.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 581 of file configChoiceField.py.
|
inherited |
Definition at line 201 of file configChoiceField.py.
|
inherited |
Update values of fields specified by the keyword arguments.
Parameters
----------
**kw
Keywords are configuration field names. Values are configuration
field values.
Notes
-----
The ``__at`` and ``__label`` keyword arguments are special internal
keywords. They are used to strip out any internal steps from the
history tracebacks of the config. Do not modify these keywords to
subvert a `~lsst.pex.config.Config` instance's history.
Examples
--------
This is a config with three fields:
>>> from lsst.pex.config import Config, Field
>>> class DemoConfig(Config):
... fieldA = Field(doc="Field A", dtype=int, default=42)
... fieldB = Field(doc="Field B", dtype=bool, default=True)
... fieldC = Field(doc="Field C", dtype=str, default="Hello world")
>>> config = DemoConfig()
These are the default values of each field:
>>> for name, value in config.iteritems():
... print(f"{name}: {value}")
fieldA: 42
fieldB: True
fieldC: 'Hello world'
Using this method to update ``fieldA`` and ``fieldC``:
>>> config.update(fieldA=13, fieldC="Updated!")
Now the values of each field are:
>>> for name, value in config.iteritems():
... print(f"{name}: {value}")
fieldA: 13
fieldB: True
fieldC: 'Updated!'
Definition at line 1116 of file config.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.validate | ( | self, | |
| instance ) |
Validate the field (for internal use only).
Parameters
----------
instance : `lsst.pex.config.Config`
The config instance that contains this field.
Raises
------
lsst.pex.config.FieldValidationError
Raised if verification fails.
Notes
-----
This method provides basic validation:
- Ensures that the value is not `None` if the field is not optional.
- Ensures type correctness.
- Ensures that the user-provided ``check`` function is valid.
Most `~lsst.pex.config.Field` subclasses should call
`lsst.pex.config.Field.validate` if they re-implement
`~lsst.pex.config.Field.validate`.
Reimplemented from lsst.pex.config.config.Field.
Definition at line 569 of file configChoiceField.py.
|
inherited |
Get field values.
Returns
-------
values : `~collections.abc.ValuesView`
Iterator of field values.
Definition at line 995 of file config.py.
|
protectedinherited |
Definition at line 182 of file configChoiceField.py.
|
protectedinherited |
Definition at line 180 of file configChoiceField.py.
|
protectedinherited |
Definition at line 183 of file configChoiceField.py.
|
protectedinherited |
|
protectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
protectedinherited |
|
protectedinherited |
Definition at line 181 of file configChoiceField.py.
|
protectedinherited |
|
staticprotectedinherited |
|
protectedinherited |
Definition at line 186 of file configChoiceField.py.
|
inherited |
|
static |
Definition at line 494 of file configChoiceField.py.
| lsst.pex.config.configChoiceField.ConfigChoiceField.multi = multi |
Definition at line 508 of file configChoiceField.py.
|
inherited |
|
staticinherited |
| lsst.pex.config.configChoiceField.ConfigChoiceField.typemap = typemap |
Definition at line 507 of file configChoiceField.py.
|
inherited |
Definition at line 208 of file configChoiceField.py.
|
staticinherited |
Definition at line 293 of file configChoiceField.py.
|
staticinherited |
|
staticinherited |
Definition at line 278 of file configChoiceField.py.
|
staticinherited |
Definition at line 272 of file configChoiceField.py.