LSST Applications g00d0e8bbd7+8c5ae1fdc5,g013ef56533+603670b062,g083dd6704c+2e189452a7,g199a45376c+0ba108daf9,g1c5cce2383+bc9f6103a4,g1fd858c14a+cd69ed4fc1,g210f2d0738+c4742f2e9e,g262e1987ae+612fa42d85,g29ae962dfc+83d129e820,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+5eaa884f2a,g47891489e3+e32160a944,g53246c7159+8c5ae1fdc5,g5b326b94bb+dcc56af22d,g64539dfbff+c4742f2e9e,g67b6fd64d1+e32160a944,g74acd417e5+c122e1277d,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g88cb488625+47d24e4084,g89139ef638+e32160a944,g8d7436a09f+d14b4ff40a,g8ea07a8fe4+b212507b11,g90f42f885a+e1755607f3,g97be763408+34be90ab8c,g98df359435+ec1fa61bf1,ga2180abaac+8c5ae1fdc5,ga9e74d7ce9+43ac651df0,gbf99507273+8c5ae1fdc5,gc2a301910b+c4742f2e9e,gca7fc764a6+e32160a944,gd7ef33dd92+e32160a944,gdab6d2f7ff+c122e1277d,gdb1e2cdc75+1b18322db8,ge410e46f29+e32160a944,ge41e95a9f2+c4742f2e9e,geaed405ab2+0d91c11c6d,w.2025.44
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.pex.config.config.Config Class Reference
Inheritance diagram for lsst.pex.config.config.Config:
lsst.pex.config.config.ConfigMeta lsst.afw.geom.transformConfig.AffineTransformConfig lsst.afw.geom.transformConfig.IdentityTransformConfig lsst.afw.geom.transformConfig.MultiTransformConfig lsst.afw.geom.transformConfig.OneTransformConfig lsst.afw.geom.transformConfig.RadialTransformConfig lsst.afw.geom.transformConfig.TransformConfig lsst.afw.math._chebyshevBoundedFieldConfig.ChebyshevBoundedFieldConfig lsst.dax.apdb.legacy_config.ApdbConfig lsst.fgcmcal.sedterms.Sedboundaryterm lsst.fgcmcal.sedterms.SedboundarytermDict lsst.fgcmcal.sedterms.Sedterm lsst.fgcmcal.sedterms.SedtermDict lsst.ip.diffim.subtractImages.AlardLuptonSubtractBaseConfig lsst.ip.isr.ampOffset.AmpOffsetConfig lsst.ip.isr.crosstalk.CrosstalkConfig lsst.ip.isr.deferredCharge.DeferredChargeConfig lsst.ip.isr.fringe.FringeConfig lsst.ip.isr.fringe.FringeStatisticsConfig lsst.ip.isr.masking.MaskingConfig lsst.ip.isr.straylight.StrayLightConfig lsst.ip.isr.vignette.VignetteConfig lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateConfig lsst.meas.algorithms.computeExPsf.ComputeExPsfConfig lsst.meas.algorithms.findGlintTrails.FindGlintTrailsConfig lsst.meas.algorithms.gaussianPsfFactory.GaussianPsfFactory lsst.meas.algorithms.indexerRegistry.HtmIndexerConfig lsst.meas.algorithms.measureApCorr.MeasureApCorrConfig lsst.meas.algorithms.noise_covariance.ComputeNoiseCorrelationConfig lsst.meas.algorithms.normalizedCalibrationFlux.NormalizedCalibrationFluxConfig lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesConfig lsst.meas.algorithms.scaleVariance.ScaleVarianceConfig lsst.meas.algorithms.setPrimaryFlags.SetPrimaryFlagsConfig lsst.meas.algorithms.skyObjects.SkyObjectsConfig lsst.meas.algorithms.treecorrUtils.TreecorrConfig lsst.meas.astrom.directMatch.DirectMatchConfigWithoutLoader lsst.meas.astrom.fitSipDistortion.FitSipDistortionConfig lsst.meas.base._id_generator.BaseIdGeneratorConfig lsst.meas.base.applyApCorr.ApplyApCorrConfig lsst.meas.base.baseMeasurement.SimpleBaseMeasurementConfig lsst.meas.base.baseMeasurement.SourceSlotConfig lsst.meas.base.catalogCalculation.CatalogCalculationConfig lsst.meas.base.noiseReplacer.NoiseReplacerConfig lsst.meas.base.pluginsBase.BasePluginConfig lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxConfig lsst.pex.config.configChoiceField.ConfigInstanceDict lsst.pex.config.configDictField.ConfigDict lsst.pex.config.configurableActions._configurableAction.ConfigurableAction lsst.pex.config.configurableActions.tests.TestConfig lsst.pipe.tasks.background.BackgroundConfig lsst.pipe.tasks.background.FocalPlaneBackgroundConfig lsst.pipe.tasks.background.MaskObjectsConfig lsst.pipe.tasks.background.SkyMeasurementConfig lsst.pipe.tasks.background.SkyStatsConfig lsst.pipe.tasks.colorterms.Colorterm lsst.pipe.tasks.colorterms.ColortermDict lsst.pipe.tasks.colorterms.ColortermLibrary lsst.pipe.tasks.diffractionSpikeMask.DiffractionSpikeMaskConfig lsst.pipe.tasks.extended_psf.DetectorsInRegion lsst.pipe.tasks.extended_psf.StackBrightStarsConfig lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseConfig lsst.pipe.tasks.multiBandUtils.CullPeaksConfig lsst.pipe.tasks.registerImage.RegisterConfig lsst.skymap.packers.SkyMapDimensionPackerConfig

Public Member Functions

 __iter__ (self)
 
 keys (self)
 
 values (self)
 
 items (self)
 
 __contains__ (self, name)
 
 __new__ (cls, *args, **kw)
 
Config copy (self)
 
 __reduce__ (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)
 
 save (self, filename, root="config")
 
 saveToString (self, skipImports=False)
 
 saveToStream (self, outfile, root="config", skipImports=False)
 
 freeze (self)
 
 toDict (self)
 
 names (self)
 
 validate (self)
 
 formatHistory (self, name, **kwargs)
 
 __setattr__ (self, attr, value, at=None, label="assignment")
 
 __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)
 

Protected Member Functions

 _save (self, outfile)
 
 _collectImports (self)
 
 _rename (self, name)
 
 _fromPython (cls, config_py)
 

Protected Attributes

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

 history = property(lambda x: x._history)
 

Detailed Description

Base class for configuration (*config*) objects.

Notes
-----
A ``Config`` object will usually have several `~lsst.pex.config.Field`
instances as class attributes. These are used to define most of the base
class behavior.

``Config`` implements a mapping API that provides many `dict`-like methods,
such as `keys`, `values`, and `items`. ``Config`` instances also support
the ``in`` operator to test if a field is in the config. Unlike a `dict`,
``Config`` classes are not subscriptable. Instead, access individual
fields as attributes of the configuration instance.

Examples
--------
Config classes are subclasses of ``Config`` that have
`~lsst.pex.config.Field` instances (or instances of
`~lsst.pex.config.Field` subclasses) as class attributes:

>>> from lsst.pex.config import Config, Field, ListField
>>> class DemoConfig(Config):
...     intField = Field(doc="An integer field", dtype=int, default=42)
...     listField = ListField(
...         doc="List of favorite beverages.",
...         dtype=str,
...         default=["coffee", "green tea", "water"],
...     )
>>> config = DemoConfig()

Configs support many `dict`-like APIs:

>>> config.keys()
['intField', 'listField']
>>> "intField" in config
True

Individual fields can be accessed as attributes of the configuration:

>>> config.intField
42
>>> config.listField.append("earl grey tea")
>>> print(config.listField)
['coffee', 'green tea', 'water', 'earl grey tea']

Definition at line 929 of file config.py.

Member Function Documentation

◆ __contains__()

lsst.pex.config.config.Config.__contains__ ( self,
name )
Return `True` if the specified field exists in this config.

Parameters
----------
name : `str`
    Field name to test for.

Returns
-------
in : `bool`
    `True` if the specified field exists in the config.

Definition at line 1018 of file config.py.

1018 def __contains__(self, name):
1019 """Return `True` if the specified field exists in this config.
1020
1021 Parameters
1022 ----------
1023 name : `str`
1024 Field name to test for.
1025
1026 Returns
1027 -------
1028 in : `bool`
1029 `True` if the specified field exists in the config.
1030 """
1031 return self._storage.__contains__(name)
1032

◆ __delattr__()

lsst.pex.config.config.Config.__delattr__ ( self,
attr,
at = None,
label = "deletion" )

Definition at line 1617 of file config.py.

1617 def __delattr__(self, attr, at=None, label="deletion"):
1618 if attr in self._fields:
1619 if at is None:
1620 at = getCallStack()
1621 self._fields[attr].__delete__(self, at=at, label=label)
1622 else:
1623 object.__delattr__(self, attr)
1624

◆ __eq__()

lsst.pex.config.config.Config.__eq__ ( self,
other )

Definition at line 1625 of file config.py.

1625 def __eq__(self, other):
1626 if type(other) is type(self):
1627 for name in self._fields:
1628 thisValue = getattr(self, name)
1629 otherValue = getattr(other, name)
1630 if isinstance(thisValue, float) and math.isnan(thisValue):
1631 if not math.isnan(otherValue):
1632 return False
1633 elif thisValue != otherValue:
1634 return False
1635 return True
1636 return False
1637

◆ __init_subclass__()

lsst.pex.config.config.Config.__init_subclass__ ( cls,
** kwargs )
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.

1694 def __init_subclass__(cls, **kwargs):
1695 """Run initialization for every subclass.
1696
1697 Specifically registers the subclass with a YAML representer
1698 and YAML constructor (if pyyaml is available)
1699 """
1700 super().__init_subclass__(**kwargs)
1701
1702 if not yaml:
1703 return
1704
1705 yaml.add_representer(cls, _yaml_config_representer)
1706

◆ __iter__()

lsst.pex.config.config.Config.__iter__ ( self)
Iterate over fields.

Definition at line 981 of file config.py.

981 def __iter__(self):
982 """Iterate over fields."""
983 return self._fields.__iter__()
984

◆ __ne__()

lsst.pex.config.config.Config.__ne__ ( self,
other )

Definition at line 1638 of file config.py.

1638 def __ne__(self, other):
1639 return not self.__eq__(other)
1640

◆ __new__()

lsst.pex.config.config.Config.__new__ ( cls,
* args,
** kw )
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.

1033 def __new__(cls, *args, **kw):
1034 """Allocate a new `lsst.pex.config.Config` object.
1035
1036 In order to ensure that all Config object are always in a proper state
1037 when handed to users or to derived `~lsst.pex.config.Config` classes,
1038 some attributes are handled at allocation time rather than at
1039 initialization.
1040
1041 This ensures that even if a derived `~lsst.pex.config.Config` class
1042 implements ``__init__``, its author does not need to be concerned about
1043 when or even the base ``Config.__init__`` should be called.
1044 """
1045 name = kw.pop("__name", None)
1046 at = kw.pop("__at", getCallStack())
1047 # remove __label and ignore it
1048 kw.pop("__label", "default")
1049
1050 instance = object.__new__(cls)
1051 instance._frozen = False
1052 instance._name = name
1053 instance._storage = {}
1054 instance._history = {}
1055 instance._imports = set()
1056 # load up defaults
1057 for field in instance._fields.values():
1058 instance._history[field.name] = []
1059 field.__set__(instance, field.default, at=at + [field.source], label="default")
1060 # set custom default-overrides
1061 instance.setDefaults()
1062 # set constructor overrides
1063 instance.update(__at=at, **kw)
1064 return instance
1065

◆ __reduce__()

lsst.pex.config.config.Config.__reduce__ ( self)
Reduction for pickling (function with arguments to reproduce).

We need to condense and reconstitute the `~lsst.pex.config.Config`,
since it may contain lambdas (as the ``check`` elements) that cannot
be pickled.

Definition at line 1090 of file config.py.

1090 def __reduce__(self):
1091 """Reduction for pickling (function with arguments to reproduce).
1092
1093 We need to condense and reconstitute the `~lsst.pex.config.Config`,
1094 since it may contain lambdas (as the ``check`` elements) that cannot
1095 be pickled.
1096 """
1097 # The stream must be in characters to match the API but pickle
1098 # requires bytes
1099 stream = io.StringIO()
1100 self.saveToStream(stream)
1101 return (unreduceConfig, (self.__class__, stream.getvalue().encode()))
1102

◆ __repr__()

lsst.pex.config.config.Config.__repr__ ( self)

Definition at line 1644 of file config.py.

1644 def __repr__(self):
1645 return "{}({})".format(
1646 _typeStr(self),
1647 ", ".join(f"{k}={v!r}" for k, v in self.toDict().items() if v is not None),
1648 )
1649

◆ __setattr__()

lsst.pex.config.config.Config.__setattr__ ( self,
attr,
value,
at = None,
label = "assignment" )
Set an attribute (such as a field's value).

Notes
-----
Unlike normal Python objects, `~lsst.pex.config.Config` objects are
locked such that no additional attributes nor properties may be added
to them dynamically.

Although this is not the standard Python behavior, it helps to protect
users from accidentally mispelling a field name, or trying to set a
non-existent field.

Definition at line 1582 of file config.py.

1582 def __setattr__(self, attr, value, at=None, label="assignment"):
1583 """Set an attribute (such as a field's value).
1584
1585 Notes
1586 -----
1587 Unlike normal Python objects, `~lsst.pex.config.Config` objects are
1588 locked such that no additional attributes nor properties may be added
1589 to them dynamically.
1590
1591 Although this is not the standard Python behavior, it helps to protect
1592 users from accidentally mispelling a field name, or trying to set a
1593 non-existent field.
1594 """
1595 if attr in self._fields:
1596 if self._fields[attr].deprecated is not None:
1597 fullname = _joinNamePath(self._name, self._fields[attr].name)
1598 warnings.warn(
1599 f"Config field {fullname} is deprecated: {self._fields[attr].deprecated}",
1600 FutureWarning,
1601 stacklevel=2,
1602 )
1603 if at is None:
1604 at = getCallStack()
1605 # This allows Field descriptors to work.
1606 self._fields[attr].__set__(self, value, at=at, label=label)
1607 elif hasattr(getattr(self.__class__, attr, None), "__set__"):
1608 # This allows properties and other non-Field descriptors to work.
1609 return object.__setattr__(self, attr, value)
1610 elif attr in self.__dict__ or attr in ("_name", "_history", "_storage", "_frozen", "_imports"):
1611 # This allows specific private attributes to work.
1612 self.__dict__[attr] = value
1613 else:
1614 # We throw everything else.
1615 raise AttributeError(f"{_typeStr(self)} has no attribute {attr}")
1616

◆ __str__()

lsst.pex.config.config.Config.__str__ ( self)

Definition at line 1641 of file config.py.

1641 def __str__(self):
1642 return str(self.toDict())
1643

◆ _collectImports()

lsst.pex.config.config.Config._collectImports ( self)
protected
Add module containing self to the list of things to import and
then loops over all the fields in the config calling a corresponding
collect method.

The field method will call _collectImports on any
configs it may own and return the set of things to import. This
returned set will be merged with the set of imports for this config
class.

Reimplemented in lsst.pex.config.configChoiceField.ConfigChoiceField.

Definition at line 1438 of file config.py.

1438 def _collectImports(self):
1439 """Add module containing self to the list of things to import and
1440 then loops over all the fields in the config calling a corresponding
1441 collect method.
1442
1443 The field method will call _collectImports on any
1444 configs it may own and return the set of things to import. This
1445 returned set will be merged with the set of imports for this config
1446 class.
1447 """
1448 self._imports.add(self.__module__)
1449 for field in self._fields.values():
1450 field._collectImports(self, self._imports)
1451

◆ _fromPython()

lsst.pex.config.config.Config._fromPython ( cls,
config_py )
protected
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.

1708 def _fromPython(cls, config_py):
1709 """Instantiate a `Config`-subclass from serialized Python form.
1710
1711 Parameters
1712 ----------
1713 config_py : `str`
1714 A serialized form of the Config as created by
1715 `Config.saveToStream`.
1716
1717 Returns
1718 -------
1719 config : `Config`
1720 Reconstructed `Config` instant.
1721 """
1722 cls = _classFromPython(config_py)
1723 return unreduceConfig(cls, config_py)
1724
1725

◆ _rename()

lsst.pex.config.config.Config._rename ( self,
name )
protected
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 in lsst.pex.config.configChoiceField.ConfigInstanceDict.

Definition at line 1506 of file config.py.

1506 def _rename(self, name):
1507 """Rename this config object in its parent `~lsst.pex.config.Config`.
1508
1509 Parameters
1510 ----------
1511 name : `str`
1512 New name for this config in its parent `~lsst.pex.config.Config`.
1513
1514 Notes
1515 -----
1516 This method uses the `~lsst.pex.config.Field.rename` method of
1517 individual `lsst.pex.config.Field` instances.
1518 `lsst.pex.config.Field` subclasses may need to implement a ``rename``
1519 method for *this* method to work.
1520
1521 See Also
1522 --------
1523 lsst.pex.config.Field.rename
1524 """
1525 self._name = name
1526 for field in self._fields.values():
1527 field.rename(self)
1528

◆ _save()

lsst.pex.config.config.Config._save ( self,
outfile )
protected
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.

1426 def _save(self, outfile):
1427 """Save this config to an open stream object.
1428
1429 Parameters
1430 ----------
1431 outfile : file-like object
1432 Destination file object write the config into. Accepts strings not
1433 bytes.
1434 """
1435 for field in self._fields.values():
1436 field.save(outfile, self)
1437

◆ compare()

lsst.pex.config.config.Config.compare ( self,
other,
shortcut = True,
rtol = 1e-8,
atol = 1e-8,
output = None )
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.

1650 def compare(self, other, shortcut=True, rtol=1e-8, atol=1e-8, output=None):
1651 """Compare this configuration to another `~lsst.pex.config.Config` for
1652 equality.
1653
1654 Parameters
1655 ----------
1656 other : `lsst.pex.config.Config`
1657 Other `~lsst.pex.config.Config` object to compare against this
1658 config.
1659 shortcut : `bool`, optional
1660 If `True`, return as soon as an inequality is found. Default is
1661 `True`.
1662 rtol : `float`, optional
1663 Relative tolerance for floating point comparisons.
1664 atol : `float`, optional
1665 Absolute tolerance for floating point comparisons.
1666 output : callable, optional
1667 A callable that takes a string, used (possibly repeatedly) to
1668 report inequalities.
1669
1670 Returns
1671 -------
1672 isEqual : `bool`
1673 `True` when the two `lsst.pex.config.Config` instances are equal.
1674 `False` if there is an inequality.
1675
1676 See Also
1677 --------
1678 lsst.pex.config.compareConfigs
1679
1680 Notes
1681 -----
1682 Unselected targets of `~lsst.pex.config.RegistryField` fields and
1683 unselected choices of `~lsst.pex.config.ConfigChoiceField` fields
1684 are not considered by this method.
1685
1686 Floating point comparisons are performed by `numpy.allclose`.
1687 """
1688 name1 = self._name if self._name is not None else "config"
1689 name2 = other._name if other._name is not None else "config"
1690 name = getComparisonName(name1, name2)
1691 return compareConfigs(name, self, other, shortcut=shortcut, rtol=rtol, atol=atol, output=output)
1692

◆ copy()

Config lsst.pex.config.config.Config.copy ( self)
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.

1066 def copy(self) -> Config:
1067 """Return a deep copy of this config.
1068
1069 Notes
1070 -----
1071 The returned config object is not frozen, even if the original was.
1072 If a nested config object is copied, it retains the name from its
1073 original hierarchy.
1074
1075 Nested objects are only shared between the new and old configs if they
1076 are not possible to modify via the config's interfaces (e.g. entries
1077 in the the history list are not copied, but the lists themselves are,
1078 so modifications to one copy do not modify the other).
1079 """
1080 instance = object.__new__(type(self))
1081 instance._frozen = False
1082 instance._name = self._name
1083 instance._history = {k: list(v) for k, v in self._history.items()}
1084 instance._imports = set(self._imports)
1085 # Important to set up storage last, since fields sometimes store
1086 # proxy objects that reference their parent (especially for history).
1087 instance._storage = {k: self._fields[k]._copy_storage(self, instance) for k in self._storage}
1088 return instance
1089

◆ formatHistory()

lsst.pex.config.config.Config.formatHistory ( self,
name,
** kwargs )
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.

1555 def formatHistory(self, name, **kwargs):
1556 """Format a configuration field's history to a human-readable format.
1557
1558 Parameters
1559 ----------
1560 name : `str`
1561 Name of a `~lsst.pex.config.Field` in this config.
1562 **kwargs
1563 Keyword arguments passed to `lsst.pex.config.history.format`.
1564
1565 Returns
1566 -------
1567 history : `str`
1568 A string containing the formatted history.
1569
1570 See Also
1571 --------
1572 lsst.pex.config.history.format
1573 """
1574 import lsst.pex.config.history as pexHist
1575
1576 return pexHist.format(self, name, **kwargs)
1577

◆ freeze()

lsst.pex.config.config.Config.freeze ( self)
Make this config, and all subconfigs, read-only.

Reimplemented in lsst.pex.config.configChoiceField.ConfigChoiceField, and lsst.pex.config.configChoiceField.ConfigInstanceDict.

Definition at line 1420 of file config.py.

1420 def freeze(self):
1421 """Make this config, and all subconfigs, read-only."""
1422 self._frozen = True
1423 for field in self._fields.values():
1424 field.freeze(self)
1425

◆ items()

lsst.pex.config.config.Config.items ( self)
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.

1005 def items(self):
1006 """Get configurations as ``(field name, field value)`` pairs.
1007
1008 Returns
1009 -------
1010 items : `~collections.abc.ItemsView`
1011 Iterator of tuples for each configuration. Tuple items are:
1012
1013 0. Field name.
1014 1. Field value.
1015 """
1016 return self._storage.items()
1017

◆ keys()

lsst.pex.config.config.Config.keys ( self)
Get field names.

Returns
-------
names : `~collections.abc.KeysView`
    List of `lsst.pex.config.Field` names.

Definition at line 985 of file config.py.

985 def keys(self):
986 """Get field names.
987
988 Returns
989 -------
990 names : `~collections.abc.KeysView`
991 List of `lsst.pex.config.Field` names.
992 """
993 return self._storage.keys()
994

◆ load()

lsst.pex.config.config.Config.load ( self,
filename,
root = "config" )
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.

1174 def load(self, filename, root="config"):
1175 """Modify this config in place by executing the Python code in a
1176 configuration file.
1177
1178 Parameters
1179 ----------
1180 filename : `str`
1181 Name of the configuration file. A configuration file is Python
1182 module.
1183 root : `str`, optional
1184 Name of the variable in file that refers to the config being
1185 overridden.
1186
1187 For example, the value of root is ``"config"`` and the file
1188 contains::
1189
1190 config.myField = 5
1191
1192 Then this config's field ``myField`` is set to ``5``.
1193
1194 See Also
1195 --------
1196 lsst.pex.config.Config.loadFromStream
1197 lsst.pex.config.Config.loadFromString
1198 lsst.pex.config.Config.save
1199 lsst.pex.config.Config.saveToStream
1200 lsst.pex.config.Config.saveToString
1201 """
1202 with open(filename) as f:
1203 code = compile(f.read(), filename=filename, mode="exec")
1204 self.loadFromString(code, root=root, filename=filename)
1205

◆ loadFromStream()

lsst.pex.config.config.Config.loadFromStream ( self,
stream,
root = "config",
filename = None,
extraLocals = None )
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.

1206 def loadFromStream(self, stream, root="config", filename=None, extraLocals=None):
1207 """Modify this Config in place by executing the Python code in the
1208 provided stream.
1209
1210 Parameters
1211 ----------
1212 stream : file-like object, `str`, `bytes`, or `~types.CodeType`
1213 Stream containing configuration override code. If this is a
1214 code object, it should be compiled with ``mode="exec"``.
1215 root : `str`, optional
1216 Name of the variable in file that refers to the config being
1217 overridden.
1218
1219 For example, the value of root is ``"config"`` and the file
1220 contains::
1221
1222 config.myField = 5
1223
1224 Then this config's field ``myField`` is set to ``5``.
1225 filename : `str`, optional
1226 Name of the configuration file, or `None` if unknown or contained
1227 in the stream. Used for error reporting.
1228 extraLocals : `dict` of `str` to `object`, optional
1229 Any extra variables to include in local scope when loading.
1230
1231 Notes
1232 -----
1233 For backwards compatibility reasons, this method accepts strings, bytes
1234 and code objects as well as file-like objects. New code should use
1235 `loadFromString` instead for most of these types.
1236
1237 See Also
1238 --------
1239 lsst.pex.config.Config.load
1240 lsst.pex.config.Config.loadFromString
1241 lsst.pex.config.Config.save
1242 lsst.pex.config.Config.saveToStream
1243 lsst.pex.config.Config.saveToString
1244 """
1245 if hasattr(stream, "read"):
1246 if filename is None:
1247 filename = getattr(stream, "name", "?")
1248 code = compile(stream.read(), filename=filename, mode="exec")
1249 else:
1250 code = stream
1251 self.loadFromString(code, root=root, filename=filename, extraLocals=extraLocals)
1252

◆ loadFromString()

lsst.pex.config.config.Config.loadFromString ( self,
code,
root = "config",
filename = None,
extraLocals = None )
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.

1253 def loadFromString(self, code, root="config", filename=None, extraLocals=None):
1254 """Modify this Config in place by executing the Python code in the
1255 provided string.
1256
1257 Parameters
1258 ----------
1259 code : `str`, `bytes`, or `~types.CodeType`
1260 Stream containing configuration override code.
1261 root : `str`, optional
1262 Name of the variable in file that refers to the config being
1263 overridden.
1264
1265 For example, the value of root is ``"config"`` and the file
1266 contains::
1267
1268 config.myField = 5
1269
1270 Then this config's field ``myField`` is set to ``5``.
1271 filename : `str`, optional
1272 Name of the configuration file, or `None` if unknown or contained
1273 in the stream. Used for error reporting.
1274 extraLocals : `dict` of `str` to `object`, optional
1275 Any extra variables to include in local scope when loading.
1276
1277 Raises
1278 ------
1279 ValueError
1280 Raised if a key in extraLocals is the same value as the value of
1281 the root argument.
1282
1283 See Also
1284 --------
1285 lsst.pex.config.Config.load
1286 lsst.pex.config.Config.loadFromStream
1287 lsst.pex.config.Config.save
1288 lsst.pex.config.Config.saveToStream
1289 lsst.pex.config.Config.saveToString
1290 """
1291 if filename is None:
1292 # try to determine the file name; a compiled string
1293 # has attribute "co_filename",
1294 filename = getattr(code, "co_filename", "?")
1295 with RecordingImporter() as importer:
1296 globals = {"__file__": filename}
1297 local = {root: self}
1298 if extraLocals is not None:
1299 # verify the value of root was not passed as extra local args
1300 if root in extraLocals:
1301 raise ValueError(
1302 f"{root} is reserved and cannot be used as a variable name in extraLocals"
1303 )
1304 local.update(extraLocals)
1305 exec(code, globals, local)
1306
1307 self._imports.update(importer.getModules())
1308

◆ names()

lsst.pex.config.config.Config.names ( self)
Get all the field names in the config, recursively.

Returns
-------
names : `list` of `str`
    Field names.

Definition at line 1476 of file config.py.

1476 def names(self):
1477 """Get all the field names in the config, recursively.
1478
1479 Returns
1480 -------
1481 names : `list` of `str`
1482 Field names.
1483 """
1484 #
1485 # Rather than sort out the recursion all over again use the
1486 # pre-existing saveToStream()
1487 #
1488 with io.StringIO() as strFd:
1489 self.saveToStream(strFd, "config")
1490 contents = strFd.getvalue()
1491 strFd.close()
1492 #
1493 # Pull the names out of the dumped config
1494 #
1495 keys = []
1496 for line in contents.split("\n"):
1497 if re.search(r"^((assert|import)\s+|\s*$|#)", line):
1498 continue
1499
1500 mat = re.search(r"^(?:config\.)?([^=]+)\s*=\s*.*", line)
1501 if mat:
1502 keys.append(mat.group(1))
1503
1504 return keys
1505

◆ save()

lsst.pex.config.config.Config.save ( self,
filename,
root = "config" )
Save a Python script to the named file, which, when loaded,
reproduces this config.

Parameters
----------
filename : `str`
    Desination filename of this configuration.
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`).

See Also
--------
lsst.pex.config.Config.saveToStream
lsst.pex.config.Config.saveToString
lsst.pex.config.Config.load
lsst.pex.config.Config.loadFromStream
lsst.pex.config.Config.loadFromString

Reimplemented in lsst.pex.config.configChoiceField.ConfigChoiceField.

Definition at line 1309 of file config.py.

1309 def save(self, filename, root="config"):
1310 """Save a Python script to the named file, which, when loaded,
1311 reproduces this config.
1312
1313 Parameters
1314 ----------
1315 filename : `str`
1316 Desination filename of this configuration.
1317 root : `str`, optional
1318 Name to use for the root config variable. The same value must be
1319 used when loading (see `lsst.pex.config.Config.load`).
1320
1321 See Also
1322 --------
1323 lsst.pex.config.Config.saveToStream
1324 lsst.pex.config.Config.saveToString
1325 lsst.pex.config.Config.load
1326 lsst.pex.config.Config.loadFromStream
1327 lsst.pex.config.Config.loadFromString
1328 """
1329 d = os.path.dirname(filename)
1330 with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=d) as outfile:
1331 self.saveToStream(outfile, root)
1332 # tempfile is hardcoded to create files with mode '0600'
1333 # for an explantion of these antics see:
1334 # https://stackoverflow.com/questions/10291131/how-to-use-os-umask-in-python
1335 umask = os.umask(0o077)
1336 os.umask(umask)
1337 os.chmod(outfile.name, (~umask & 0o666))
1338 # chmod before the move so we get quasi-atomic behavior if the
1339 # source and dest. are on the same filesystem.
1340 # os.rename may not work across filesystems
1341 shutil.move(outfile.name, filename)
1342

◆ saveToStream()

lsst.pex.config.config.Config.saveToStream ( self,
outfile,
root = "config",
skipImports = False )
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.

1371 def saveToStream(self, outfile, root="config", skipImports=False):
1372 """Save a configuration file to a stream, which, when loaded,
1373 reproduces this config.
1374
1375 Parameters
1376 ----------
1377 outfile : file-like object
1378 Destination file object write the config into. Accepts strings not
1379 bytes.
1380 root : `str`, optional
1381 Name to use for the root config variable. The same value must be
1382 used when loading (see `lsst.pex.config.Config.load`).
1383 skipImports : `bool`, optional
1384 If `True` then do not include ``import`` statements in output,
1385 this is to support human-oriented output from ``pipetask`` where
1386 additional clutter is not useful.
1387
1388 See Also
1389 --------
1390 lsst.pex.config.Config.save
1391 lsst.pex.config.Config.saveToString
1392 lsst.pex.config.Config.load
1393 lsst.pex.config.Config.loadFromStream
1394 lsst.pex.config.Config.loadFromString
1395 """
1396 tmp = self._name
1397 self._rename(root)
1398 try:
1399 if not skipImports:
1400 self._collectImports()
1401 # Remove self from the set, as it is handled explicitly below
1402 self._imports.remove(self.__module__)
1403 configType = type(self)
1404 typeString = _typeStr(configType)
1405 outfile.write(f"import {configType.__module__}\n")
1406 # We are required to write this on a single line because
1407 # of later regex matching, rather than adopting black style
1408 # formatting.
1409 outfile.write(
1410 f'assert type({root}) is {typeString}, f"config is of type '
1411 f'{{type({root}).__module__}}.{{type({root}).__name__}} instead of {typeString}"\n\n'
1412 )
1413 for imp in sorted(self._imports):
1414 if imp in sys.modules and sys.modules[imp] is not None:
1415 outfile.write(f"import {imp}\n")
1416 self._save(outfile)
1417 finally:
1418 self._rename(tmp)
1419

◆ saveToString()

lsst.pex.config.config.Config.saveToString ( self,
skipImports = False )
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.

1343 def saveToString(self, skipImports=False):
1344 """Return the Python script form of this configuration as an executable
1345 string.
1346
1347 Parameters
1348 ----------
1349 skipImports : `bool`, optional
1350 If `True` then do not include ``import`` statements in output,
1351 this is to support human-oriented output from ``pipetask`` where
1352 additional clutter is not useful.
1353
1354 Returns
1355 -------
1356 code : `str`
1357 A code string readable by `loadFromString`.
1358
1359 See Also
1360 --------
1361 lsst.pex.config.Config.save
1362 lsst.pex.config.Config.saveToStream
1363 lsst.pex.config.Config.load
1364 lsst.pex.config.Config.loadFromStream
1365 lsst.pex.config.Config.loadFromString
1366 """
1367 buffer = io.StringIO()
1368 self.saveToStream(buffer, skipImports=skipImports)
1369 return buffer.getvalue()
1370

◆ setDefaults()

lsst.pex.config.config.Config.setDefaults ( self)
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.

1103 def setDefaults(self):
1104 """Subclass hook for computing defaults.
1105
1106 Notes
1107 -----
1108 Derived `~lsst.pex.config.Config` classes that must compute defaults
1109 rather than using the `~lsst.pex.config.Field` instances's defaults
1110 should do so here. To correctly use inherited defaults,
1111 implementations of ``setDefaults`` must call their base class's
1112 ``setDefaults``.
1113 """
1114 pass
1115

◆ toDict()

lsst.pex.config.config.Config.toDict ( self)
Make a dictionary of field names and their values.

Returns
-------
dict_ : `dict`
    Dictionary with keys that are `~lsst.pex.config.Field` names.
    Values are `~lsst.pex.config.Field` values.

See Also
--------
lsst.pex.config.Field.toDict

Notes
-----
This method uses the `~lsst.pex.config.Field.toDict` method of
individual fields. Subclasses of `~lsst.pex.config.Field` may need to
implement a ``toDict`` method for *this* method to work.

Reimplemented in lsst.pex.config.configChoiceField.ConfigChoiceField.

Definition at line 1452 of file config.py.

1452 def toDict(self):
1453 """Make a dictionary of field names and their values.
1454
1455 Returns
1456 -------
1457 dict_ : `dict`
1458 Dictionary with keys that are `~lsst.pex.config.Field` names.
1459 Values are `~lsst.pex.config.Field` values.
1460
1461 See Also
1462 --------
1463 lsst.pex.config.Field.toDict
1464
1465 Notes
1466 -----
1467 This method uses the `~lsst.pex.config.Field.toDict` method of
1468 individual fields. Subclasses of `~lsst.pex.config.Field` may need to
1469 implement a ``toDict`` method for *this* method to work.
1470 """
1471 dict_ = {}
1472 for name, field in self._fields.items():
1473 dict_[name] = field.toDict(self)
1474 return dict_
1475

◆ update()

lsst.pex.config.config.Config.update ( self,
** kw )
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.

1116 def update(self, **kw):
1117 """Update values of fields specified by the keyword arguments.
1118
1119 Parameters
1120 ----------
1121 **kw
1122 Keywords are configuration field names. Values are configuration
1123 field values.
1124
1125 Notes
1126 -----
1127 The ``__at`` and ``__label`` keyword arguments are special internal
1128 keywords. They are used to strip out any internal steps from the
1129 history tracebacks of the config. Do not modify these keywords to
1130 subvert a `~lsst.pex.config.Config` instance's history.
1131
1132 Examples
1133 --------
1134 This is a config with three fields:
1135
1136 >>> from lsst.pex.config import Config, Field
1137 >>> class DemoConfig(Config):
1138 ... fieldA = Field(doc="Field A", dtype=int, default=42)
1139 ... fieldB = Field(doc="Field B", dtype=bool, default=True)
1140 ... fieldC = Field(doc="Field C", dtype=str, default="Hello world")
1141 >>> config = DemoConfig()
1142
1143 These are the default values of each field:
1144
1145 >>> for name, value in config.iteritems():
1146 ... print(f"{name}: {value}")
1147 fieldA: 42
1148 fieldB: True
1149 fieldC: 'Hello world'
1150
1151 Using this method to update ``fieldA`` and ``fieldC``:
1152
1153 >>> config.update(fieldA=13, fieldC="Updated!")
1154
1155 Now the values of each field are:
1156
1157 >>> for name, value in config.iteritems():
1158 ... print(f"{name}: {value}")
1159 fieldA: 13
1160 fieldB: True
1161 fieldC: 'Updated!'
1162 """
1163 at = kw.pop("__at", getCallStack())
1164 label = kw.pop("__label", "update")
1165
1166 for name, value in kw.items():
1167 try:
1168 field = self._fields[name]
1169 field.__set__(self, value, at=at, label=label)
1170 except KeyError as e:
1171 e.add_note(f"No field of name {name} exists in config type {_typeStr(self)}")
1172 raise
1173

◆ validate()

lsst.pex.config.config.Config.validate ( self)
Validate the Config, raising an exception if invalid.

Raises
------
lsst.pex.config.FieldValidationError
    Raised if verification fails.

Notes
-----
The base class implementation performs type checks on all fields by
calling their `~lsst.pex.config.Field.validate` methods.

Complex single-field validation can be defined by deriving new Field
types. For convenience, some derived `lsst.pex.config.Field`-types
(`~lsst.pex.config.ConfigField` and
`~lsst.pex.config.ConfigChoiceField`) are defined in
``lsst.pex.config`` that handle recursing into subconfigs.

Inter-field relationships should only be checked in derived
`~lsst.pex.config.Config` classes after calling this method, and base
validation is complete.

Reimplemented in lsst.fgcmcal.sedterms.Sedterm, lsst.pex.config.configChoiceField.ConfigChoiceField, lsst.pex.config.configurableActions.tests.ActionTest1, lsst.pex.config.configurableActions.tests.ActionTest2, lsst.pex.config.configurableActions.tests.ActionTest3, lsst.pex.config.configurableActions.tests.TestDivideAction, lsst.pipe.tasks.background.MaskObjectsConfig, lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseConfig, lsst.afw.geom.transformConfig.RadialTransformConfig, lsst.ip.isr.ampOffset.AmpOffsetConfig, lsst.meas.algorithms.gaussianPsfFactory.GaussianPsfFactory, lsst.meas.algorithms.measureApCorr.MeasureApCorrConfig, lsst.meas.algorithms.treecorrUtils.TreecorrConfig, lsst.meas.base.baseMeasurement.BaseMeasurementConfig, lsst.meas.base.baseMeasurement.SimpleBaseMeasurementConfig, and lsst.meas.base.compensatedGaussian._compensatedTophat.SingleFrameCompensatedTophatFluxConfig.

Definition at line 1529 of file config.py.

1529 def validate(self):
1530 """Validate the Config, raising an exception if invalid.
1531
1532 Raises
1533 ------
1534 lsst.pex.config.FieldValidationError
1535 Raised if verification fails.
1536
1537 Notes
1538 -----
1539 The base class implementation performs type checks on all fields by
1540 calling their `~lsst.pex.config.Field.validate` methods.
1541
1542 Complex single-field validation can be defined by deriving new Field
1543 types. For convenience, some derived `lsst.pex.config.Field`-types
1544 (`~lsst.pex.config.ConfigField` and
1545 `~lsst.pex.config.ConfigChoiceField`) are defined in
1546 ``lsst.pex.config`` that handle recursing into subconfigs.
1547
1548 Inter-field relationships should only be checked in derived
1549 `~lsst.pex.config.Config` classes after calling this method, and base
1550 validation is complete.
1551 """
1552 for field in self._fields.values():
1553 field.validate(self)
1554

◆ values()

lsst.pex.config.config.Config.values ( self)
Get field values.

Returns
-------
values : `~collections.abc.ValuesView`
    Iterator of field values.

Definition at line 995 of file config.py.

995 def values(self):
996 """Get field values.
997
998 Returns
999 -------
1000 values : `~collections.abc.ValuesView`
1001 Iterator of field values.
1002 """
1003 return self._storage.values()
1004

Member Data Documentation

◆ _fields

dict lsst.pex.config.config.ConfigMeta._fields = {}
protectedinherited

Definition at line 228 of file config.py.

◆ _frozen

bool lsst.pex.config.config.Config._frozen = True
protected

Definition at line 1422 of file config.py.

◆ _history

dict lsst.pex.config.config.Config._history [str, list[Any]]
staticprotected

Definition at line 978 of file config.py.

◆ _imports

lsst.pex.config.config.Config._imports [Any]
staticprotected

Definition at line 979 of file config.py.

◆ _name

lsst.pex.config.config.Config._name = name
protected

Definition at line 1525 of file config.py.

◆ _source

lsst.pex.config.config.ConfigMeta._source = getStackFrame()
protectedinherited

Definition at line 229 of file config.py.

◆ _storage

dict lsst.pex.config.config.Config._storage [str, Any]
staticprotected

Definition at line 976 of file config.py.

Property Documentation

◆ history

lsst.pex.config.config.Config.history = property(lambda x: x._history)
static

Definition at line 1578 of file config.py.


The documentation for this class was generated from the following file: