FgcmFitCycleConfig¶
-
class
lsst.fgcmcal.FgcmFitCycleConfig¶ Bases:
lsst.pipe.base.PipelineTaskConfigConfig for FgcmFitCycle
Attributes Summary
aperCorrFitNBinsNumber of aperture bins used in aperture correction fit. aperCorrInputSlopeDictPer-band specification of aperture correction input slope parameters. aperCorrInputSlopesAperture correction input slope parameters. applyRefStarColorCutsApply color cuts to reference stars? ( bool, defaultTrue)approxThroughputApproximate overall throughput at start of calibration observations. approxThroughputDictPer-band specification of the approximate overall throughput at the start of calibration observations. autoHighCutNSigNumber of sigma for automatic computation of (high) outlier cut. autoPhotometricCutNSigNumber of sigma for automatic computation of (low) photometric cut. bandsBands to run calibration ( List, default[])brightObsGrayMaxMaximum gray extinction to be considered bright observation ( float, default0.15)ccdGrayFocalPlaneChebyshevOrderOrder of the 2D chebyshev polynomials for focal plane fit. ccdGrayFocalPlaneDictPer-band specification on whether to compute focal-plane residual (‘ccd gray’) corrections. ccdGrayFocalPlaneFitMinCcdMinimum number of ‘good’ CCDs required to perform focal-plane gray corrections. ccdGrayMaxStarErrMaximum error on a star observation to use in ccd gray (achromatic residual) computation ( float, default0.1)ccdGraySubCcdCompute CCD gray terms on sub-ccd scale Deprecated: This field is no longer used, and has been deprecated by DM-23699. ccdGraySubCcdChebyshevOrderOrder of the 2D chebyshev polynomials for sub-ccd gray fit. ccdGraySubCcdDictPer-band specification on whether to compute achromatic per-ccd residual (‘ccd gray’) on a sub-ccd scale. ccdGraySubCcdTriangularShould the sub-ccd gray chebyshev matrix be triangular to suppress high-order cross terms? ( bool, defaultTrue)coatingMjdsMirror coating dates in MJD ( List, default(0.0,))colorSplitBandsBand names to use to split stars by color. colorSplitIndicesBand indices to use to split stars by color Deprecated: This field is no longer used, and has been deprecated by DM-23699. connectionsConfigurations describing the connections of the PipelineTask to datatypes ( Connections, default<class 'lsst.pipe.base.config.Connections'>)cycleNumberFGCM fit cycle number. deltaMagBkgOffsetPercentilePercentile brightest stars on a visit/ccd to use to compute net offset from local background subtraction. deltaMagBkgPerCcdCompute net offset from local background subtraction per-ccd? Otherwise, use computation per visit. doReferenceCalibrationUse reference catalog as additional constraint on calibration ( bool, defaultTrue)epochMjdsEpoch boundaries in MJD ( List, default(0.0,))expGrayErrRecoverCutMaximum exposure gray error to be able to recover bad ccds via interpolation. expGrayHighCutMaximum (positive) exposure gray for a visit to be considered photometric. expGrayHighCutDictPer-band specification on maximum (positive) achromatic exposure residual (‘gray term’) for a visit to be considered photometric. expGrayInitialCutMaximum exposure/visit gray value for initial selection of possible photometric observations. expGrayPhotometricCutMaximum (negative) exposure gray for a visit to be considered photometric. expGrayPhotometricCutDictPer-band specification on maximum (negative) achromatic exposure residual (‘gray term’) for a visit to be considered photometric. expGrayRecoverCutMaximum (negative) exposure gray to be able to recover bad ccds via interpolation. expVarGrayPhotometricCutMaximum exposure variance to be considered possibly photometric Deprecated: This field is no longer used, and has been deprecated by DM-23699. expVarGrayPhotometricCutDictPer-band specification on maximum exposure variance to be considered possibly photometric. filterMapMapping from ‘filterName’ to band. fitBandsBands to use in atmospheric fit. fitFlagFlag for which bands are directly constrained in the FGCM fit. fitMirrorChromaticityFit (intraband) mirror chromatic term? ( bool, defaultFalse)focalPlaneSigmaClipNumber of sigma to clip outliers per focal-plane. freezeStdAtmosphereFreeze atmosphere parameters to standard (for testing) ( bool, defaultFalse)historyinstrumentParsPerBandModel instrumental parameters per band? Otherwise, instrumental parameters (QE changes with time) are shared among all bands. instrumentSlopeMinDeltaTMinimum time change (in days) between observations to use in constraining instrument slope. isFinalCycleIs this the final cycle of the fitting? Will automatically compute final selection of stars and photometric exposures, and will output zeropoints and standard stars for use in fgcmOutputProducts ( bool, defaultFalse)latitudeObservatory latitude ( float)mapLongitudeRefReference longitude for plotting maps ( float, default0.0)mapNSideHealpix nside for plotting maps ( int, default256)maxCcdGrayErrMaximum error on CCD gray offset to be considered photometric ( float, default0.05)maxIterBeforeFinalCycleMaximum fit iterations, prior to final cycle. minCcdPerExpMinimum number of good CCDs per exposure/visit to be used in calibration fit. minExpPerNightMinimum number of good exposures/visits to consider a partly photometric night ( int, default10)minObsPerBandMinimum good observations per band ( int, default2)minStarPerCcdMinimum number of good stars per CCD to be used in calibration fit. minStarPerExpMinimum number of good stars per exposure/visit to be used in calibration fit. modelMagErrorsShould FGCM model the magnitude errors from sky/fwhm? (False means trust inputs) ( bool, defaultTrue)nCoreNumber of cores to use ( int, default4)nExpPerRunNumber of exposures to run in each chunk ( int, default1000)nStarPerRunNumber of stars to run in each chunk ( int, default200000)outfileBaseFilename start for plot output files ( str)outputStandardsBeforeFinalCycleOutput standard stars prior to final cycle? Used in debugging. outputZeropointsBeforeFinalCycleOutput standard stars prior to final cycle? Used in debugging. precomputeSuperStarInitialCyclePrecompute superstar flat for initial cycle ( bool, defaultFalse)quietModeBe less verbose with logging. randomSeedRandom seed for fgcm for consistency in tests. refStarOutlierNSigNumber of sigma compared to average mag for reference star to be considered an outlier. refStarSnMinReference star signal-to-noise minimum to use in calibration. requiredBandsBands that are required for a star to be considered a calibration star. requiredFlagFlag for which bands are required for a star to be considered a calibration star in the FGCM fit. reserveFractionFraction of stars to reserve for testing ( float, default0.1)saveMetadataFlag to enable/disable metadata saving for a task, enabled by default. sedFudgeFactorsFudge factors for computing linear SED from colors. sedboundarytermsMapping from bands to SED boundary term names used is sedterms. sedtermsMapping from terms to bands for fgcm linear SED approximations. sigFgcmMaxEGrayMaximum (absolute) gray value for observation in sigma_FGCM. sigFgcmMaxEGrayDictPer-band specification for maximum (absolute) achromatic residual (gray value) for observations in sigma_fgcm (raw repeatability). sigFgcmMaxErrMaximum mag error for fitting sigma_FGCM ( float, default0.01)sigma0PhotSystematic error floor for all zeropoints ( float, default0.003)sigmaCalFitPercentileMagnitude percentile range to fit systematic error floor ( List, default(0.05, 0.15))sigmaCalPlotPercentileMagnitude percentile range to plot systematic error floor ( List, default(0.05, 0.95))sigmaCalRangeAllowed range for systematic error floor estimation ( List, default(0.001, 0.003))starColorCutsEncoded star-color cuts (to be cleaned up) ( List, default('NO_DATA',))superStarSigmaClipNumber of sigma to clip outliers when selecting for superstar flats ( float, default5.0)superStarSubCcdCompute superstar flat on sub-ccd scale Deprecated: This field is no longer used, and has been deprecated by DM-23699. superStarSubCcdChebyshevOrderOrder of the 2D chebyshev polynomials for sub-ccd superstar fit. superStarSubCcdDictPer-band specification on whether to compute superstar flat on sub-ccd scale. superStarSubCcdTriangularShould the sub-ccd superstar chebyshev matrix be triangular to suppress high-order cross terms? ( bool, defaultFalse)useQuadraticPwvModel PWV with a quadratic term for variation through the night? ( bool, defaultFalse)useRepeatabilityForExpGrayCutsUse star repeatability (instead of exposures) for computing photometric cuts? Recommended for tract mode or bands with few exposures. useRepeatabilityForExpGrayCutsDictPer-band specification on whether to use star repeatability (instead of exposures) for computing photometric cuts. utBoundaryBoundary (in UTC) from day-to-day ( float)washMjdsMirror wash MJDs ( List, default(0.0,))Methods Summary
compare(other[, shortcut, rtol, atol, output])Compare this configuration to another Configfor equality.formatHistory(name, **kwargs)Format a configuration field’s history to a human-readable format. freeze()Make this config, and all subconfigs, read-only. items()Get configurations as (field name, field value)pairs.iteritems()Iterate over (field name, field value) pairs. iterkeys()Iterate over field names itervalues()Iterate over field values. keys()Get field names. load(filename[, root])Modify this config in place by executing the Python code in a configuration file. loadFromStream(stream[, root, filename])Modify this Config in place by executing the Python code in the provided stream. names()Get all the field names in the config, recursively. save(filename[, root])Save a Python script to the named file, which, when loaded, reproduces this config. saveToStream(outfile[, root, skipImports])Save a configuration file to a stream, which, when loaded, reproduces this config. setDefaults()Subclass hook for computing defaults. toDict()Make a dictionary of field names and their values. update(**kw)Update values of fields specified by the keyword arguments. validate()Validate the Config, raising an exception if invalid. values()Get field values. Attributes Documentation
-
aperCorrFitNBins¶ Number of aperture bins used in aperture correction fit. When set to 0no fit will be performed, and the config.aperCorrInputSlopes will be used if available. (
int, default10)
-
aperCorrInputSlopeDict¶ Per-band specification of aperture correction input slope parameters. These are used on the first fit iteration, and aperture correction parameters will be updated from the data if config.aperCorrFitNBins > 0. It is recommended to set this when there is insufficient data to fit the parameters (e.g. tract mode). (
Dict, default{})
-
aperCorrInputSlopes¶ Aperture correction input slope parameters. These are used on the first fit iteration, and aperture correction parameters will be updated from the data if config.aperCorrFitNBins > 0. It is recommended to set thiswhen there is insufficient data to fit the parameters (e.g. tract mode). If set, must be same length as config.bands, and matched band-by-band. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use aperCorrInputSlopeDict instead. (
List, default[])
-
approxThroughput¶ Approximate overall throughput at start of calibration observations. May be 1 element (same for all bands) or the same length as config.bands. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use approxThroughputDict instead. (
List, default(1.0,))
-
approxThroughputDict¶ Per-band specification of the approximate overall throughput at the start of calibration observations. Must have one entry per band. Typically should be 1.0. (
Dict, default{})
-
autoHighCutNSig¶ Number of sigma for automatic computation of (high) outlier cut. Cut is based on exposure gray width (per band), unless useRepeatabilityForExpGrayCuts is set, in which case the star repeatability is used (also per band). (
float, default4.0)
-
autoPhotometricCutNSig¶ Number of sigma for automatic computation of (low) photometric cut. Cut is based on exposure gray width (per band), unless useRepeatabilityForExpGrayCuts is set, in which case the star repeatability is used (also per band). (
float, default3.0)
-
bands¶ Bands to run calibration (
List, default[])
-
ccdGrayFocalPlaneChebyshevOrder¶ Order of the 2D chebyshev polynomials for focal plane fit. (
int, default3)
-
ccdGrayFocalPlaneDict¶ Per-band specification on whether to compute focal-plane residual (‘ccd gray’) corrections. (
Dict, default{})
-
ccdGrayFocalPlaneFitMinCcd¶ Minimum number of ‘good’ CCDs required to perform focal-plane gray corrections. If there are fewer good CCDs then the gray correction is computed per-ccd. (
int, default1)
-
ccdGrayMaxStarErr¶ Maximum error on a star observation to use in ccd gray (achromatic residual) computation (
float, default0.1)
-
ccdGraySubCcd¶ Compute CCD gray terms on sub-ccd scale Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use ccdGraySubCcdDict instead. (
bool, defaultFalse)
-
ccdGraySubCcdChebyshevOrder¶ Order of the 2D chebyshev polynomials for sub-ccd gray fit. (
int, default1)
-
ccdGraySubCcdDict¶ Per-band specification on whether to compute achromatic per-ccd residual (‘ccd gray’) on a sub-ccd scale. (
Dict, default{})
-
ccdGraySubCcdTriangular¶ Should the sub-ccd gray chebyshev matrix be triangular to suppress high-order cross terms? (
bool, defaultTrue)
-
coatingMjds¶ Mirror coating dates in MJD (
List, default(0.0,))
-
colorSplitBands¶ Band names to use to split stars by color. Must have 2 entries. (
List, default('g', 'i'))
-
colorSplitIndices¶ Band indices to use to split stars by color Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use colorSplitBands instead. (
List, defaultNone)
-
connections¶ Configurations describing the connections of the PipelineTask to datatypes (
Connections, default<class 'lsst.pipe.base.config.Connections'>)
-
cycleNumber¶ FGCM fit cycle number. This is automatically incremented after each run and stage of outlier rejection. See cookbook for details. (
int)
-
deltaMagBkgOffsetPercentile¶ Percentile brightest stars on a visit/ccd to use to compute net offset from local background subtraction. (
float, default0.25)
-
deltaMagBkgPerCcd¶ Compute net offset from local background subtraction per-ccd? Otherwise, use computation per visit. (
bool, defaultFalse)
-
doReferenceCalibration¶ Use reference catalog as additional constraint on calibration (
bool, defaultTrue)
-
epochMjds¶ Epoch boundaries in MJD (
List, default(0.0,))
-
expGrayErrRecoverCut¶ Maximum exposure gray error to be able to recover bad ccds via interpolation. Visits with more gray variance will only get CCD zeropoints if there are sufficient star observations (minStarPerCcd) on that CCD. (
float, default0.05)
-
expGrayHighCut¶ Maximum (positive) exposure gray for a visit to be considered photometric. Must be same length as config.bands, and matched band-by-band. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use expGrayHighCutDict instead. (
List, default(0.0,))
-
expGrayHighCutDict¶ Per-band specification on maximum (positive) achromatic exposure residual (‘gray term’) for a visit to be considered photometric. Must have one entry per band. Broad-band filters should be 0.2. (
Dict, default{})
-
expGrayInitialCut¶ Maximum exposure/visit gray value for initial selection of possible photometric observations. (
float, default-0.25)
-
expGrayPhotometricCut¶ Maximum (negative) exposure gray for a visit to be considered photometric. Must be same length as config.bands, and matched band-by-band. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use expGrayPhotometricCutDict instead. (
List, default(0.0,))
-
expGrayPhotometricCutDict¶ Per-band specification on maximum (negative) achromatic exposure residual (‘gray term’) for a visit to be considered photometric. Must have one entry per band. Broad-band filters should be -0.05. (
Dict, default{})
-
expGrayRecoverCut¶ Maximum (negative) exposure gray to be able to recover bad ccds via interpolation. Visits with more gray extinction will only get CCD zeropoints if there are sufficient star observations (minStarPerCcd) on that CCD. (
float, default-1.0)
-
expVarGrayPhotometricCut¶ Maximum exposure variance to be considered possibly photometric Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use expVarGrayPhotometricCutDict instead. (
float, default0.0005)
-
expVarGrayPhotometricCutDict¶ Per-band specification on maximum exposure variance to be considered possibly photometric. Must have one entry per band. Broad-band filters should be 0.0005. (
Dict, default{})
-
filterMap¶ Mapping from ‘filterName’ to band. (
Dict, default{})
-
fitBands¶ Bands to use in atmospheric fit. The bands not listed here will have the atmosphere constrained from the ‘fitBands’ on the same night. Must be a subset of
config.bands(List, default[])
-
fitFlag¶ Flag for which bands are directly constrained in the FGCM fit. Bands set to 0 will have the atmosphere constrained from observations in other bands on the same night. Must be same length as config.bands, and matched band-by-band. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use fitBands instead. (
List, default(0,))
-
history¶
-
instrumentParsPerBand¶ Model instrumental parameters per band? Otherwise, instrumental parameters (QE changes with time) are shared among all bands. (
bool, defaultFalse)
-
instrumentSlopeMinDeltaT¶ Minimum time change (in days) between observations to use in constraining instrument slope. (
float, default20.0)
-
isFinalCycle¶ Is this the final cycle of the fitting? Will automatically compute final selection of stars and photometric exposures, and will output zeropoints and standard stars for use in fgcmOutputProducts (
bool, defaultFalse)
-
maxIterBeforeFinalCycle¶ Maximum fit iterations, prior to final cycle. The number of iterations will always be 0 in the final cycle for cleanup and final selection. (
int, default50)
-
minCcdPerExp¶ Minimum number of good CCDs per exposure/visit to be used in calibration fit. Visits with fewer good CCDs will have CCD zeropoints estimated where possible. (
int, default5)
-
minExpPerNight¶ Minimum number of good exposures/visits to consider a partly photometric night (
int, default10)
-
minStarPerCcd¶ Minimum number of good stars per CCD to be used in calibration fit. CCDs with fewer stars will have their calibration estimated from other CCDs in the same visit, with zeropoint error increased accordingly. (
int, default5)
-
minStarPerExp¶ Minimum number of good stars per exposure/visit to be used in calibration fit. Visits with fewer good stars will have CCD zeropoints estimated where possible. (
int, default600)
-
modelMagErrors¶ Should FGCM model the magnitude errors from sky/fwhm? (False means trust inputs) (
bool, defaultTrue)
-
outputStandardsBeforeFinalCycle¶ Output standard stars prior to final cycle? Used in debugging. (
bool, defaultFalse)
-
outputZeropointsBeforeFinalCycle¶ Output standard stars prior to final cycle? Used in debugging. (
bool, defaultFalse)
-
refStarOutlierNSig¶ Number of sigma compared to average mag for reference star to be considered an outlier. Computed per-band, and if it is an outlier in any band it is rejected from fits. (
float, default4.0)
-
refStarSnMin¶ Reference star signal-to-noise minimum to use in calibration. Set to <=0 for no cut. (
float, default50.0)
-
requiredBands¶ Bands that are required for a star to be considered a calibration star. Must be a subset of
config.bands(List, default[])
-
requiredFlag¶ Flag for which bands are required for a star to be considered a calibration star in the FGCM fit. Typically this should be the same as fitFlag. Must be same length as config.bands, and matched band-by-band. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use requiredBands instead. (
List, default(0,))
-
saveMetadata¶ Flag to enable/disable metadata saving for a task, enabled by default. (
bool, defaultTrue)
-
sedFudgeFactors¶ Fudge factors for computing linear SED from colors. Must be same length as config.bands, and matched band-by-band. Deprecated: This field has been deprecated and will be removed after v20. Please use sedSlopeTermMap and sedSlopeMap. (
List, default(0,))
-
sedboundaryterms¶ Mapping from bands to SED boundary term names used is sedterms. (
SedboundarytermDict, default<class 'lsst.fgcmcal.sedterms.SedboundarytermDict'>)
-
sedterms¶ Mapping from terms to bands for fgcm linear SED approximations. (
SedtermDict, default<class 'lsst.fgcmcal.sedterms.SedtermDict'>)
-
sigFgcmMaxEGray¶ Maximum (absolute) gray value for observation in sigma_FGCM. May be 1 element (same for all bands) or the same length as config.bands. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use sigFgcmMaxEGrayDict instead. (
List, default(0.05,))
-
sigFgcmMaxEGrayDict¶ Per-band specification for maximum (absolute) achromatic residual (gray value) for observations in sigma_fgcm (raw repeatability). Broad-band filters should be 0.05. (
Dict, default{})
-
sigmaCalFitPercentile¶ Magnitude percentile range to fit systematic error floor (
List, default(0.05, 0.15))
-
sigmaCalPlotPercentile¶ Magnitude percentile range to plot systematic error floor (
List, default(0.05, 0.95))
-
sigmaCalRange¶ Allowed range for systematic error floor estimation (
List, default(0.001, 0.003))
-
starColorCuts¶ Encoded star-color cuts (to be cleaned up) (
List, default('NO_DATA',))
-
superStarSigmaClip¶ Number of sigma to clip outliers when selecting for superstar flats (
float, default5.0)
-
superStarSubCcd¶ Compute superstar flat on sub-ccd scale Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use superStarSubCcdDict instead. (
bool, defaultTrue)
-
superStarSubCcdChebyshevOrder¶ Order of the 2D chebyshev polynomials for sub-ccd superstar fit. Global default is first-order polynomials, and should be overridden on a camera-by-camera basis depending on the ISR. (
int, default1)
-
superStarSubCcdDict¶ Per-band specification on whether to compute superstar flat on sub-ccd scale. Must have one entry per band. (
Dict, default{})
-
superStarSubCcdTriangular¶ Should the sub-ccd superstar chebyshev matrix be triangular to suppress high-order cross terms? (
bool, defaultFalse)
-
useQuadraticPwv¶ Model PWV with a quadratic term for variation through the night? (
bool, defaultFalse)
-
useRepeatabilityForExpGrayCuts¶ Use star repeatability (instead of exposures) for computing photometric cuts? Recommended for tract mode or bands with few exposures. May be 1 element (same for all bands) or the same length as config.bands. Deprecated: This field is no longer used, and has been deprecated by DM-23699. It will be removed after v20. Use useRepeatabilityForExpGrayCutsDict instead. (
List, default(False,))
-
useRepeatabilityForExpGrayCutsDict¶ Per-band specification on whether to use star repeatability (instead of exposures) for computing photometric cuts. Recommended for tract mode or bands with few visits. (
Dict, default{})
-
washMjds¶ Mirror wash MJDs (
List, default(0.0,))
Methods Documentation
-
compare(other, shortcut=True, rtol=1e-08, atol=1e-08, output=None)¶ Compare this configuration to another
Configfor equality.Parameters: - other :
lsst.pex.config.Config Other
Configobject to compare against this config.- shortcut :
bool, optional If
True, return as soon as an inequality is found. Default isTrue.- 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 Truewhen the twolsst.pex.config.Configinstances are equal.Falseif there is an inequality.
See also
Notes
Unselected targets of
RegistryFieldfields and unselected choices ofConfigChoiceFieldfields are not considered by this method.Floating point comparisons are performed by
numpy.allclose.- other :
-
formatHistory(name, **kwargs)¶ Format a configuration field’s history to a human-readable format.
Parameters: - name :
str Name of a
Fieldin this config.- kwargs
Keyword arguments passed to
lsst.pex.config.history.format.
Returns: - history :
str A string containing the formatted history.
See also
- name :
-
freeze()¶ Make this config, and all subconfigs, read-only.
-
items()¶ Get configurations as
(field name, field value)pairs.Returns: - items :
list List of tuples for each configuration. Tuple items are:
- Field name.
- Field value.
See also
- items :
-
iteritems()¶ Iterate over (field name, field value) pairs.
Yields: - item :
tuple Tuple items are:
- Field name.
- Field value.
See also
- item :
-
itervalues()¶ Iterate over field values.
Yields: - value : obj
A field value.
See also
-
keys()¶ Get field names.
Returns: - names :
list List of
lsst.pex.config.Fieldnames.
See also
- names :
-
load(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
myFieldis set to5.Deprecated: For backwards compatibility, older config files that use
root="root"instead ofroot="config"will be loaded with a warning printed tosys.stderr. This feature will be removed at some point.
See also
lsst.pex.config.Config.loadFromStream,lsst.pex.config.Config.save,lsst.pex.config.Config.saveFromStream- filename :
-
loadFromStream(stream, root='config', filename=None)¶ Modify this Config in place by executing the Python code in the provided stream.
Parameters: - stream : file-like object,
str, or compiled string 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
myFieldis set to5.Deprecated: For backwards compatibility, older config files that use
root="root"instead ofroot="config"will be loaded with a warning printed tosys.stderr. This feature will be removed at some point.- filename :
str, optional Name of the configuration file, or
Noneif unknown or contained in the stream. Used for error reporting.
See also
lsst.pex.config.Config.load,lsst.pex.config.Config.save,lsst.pex.config.Config.saveFromStream- stream : file-like object,
-
names()¶ Get all the field names in the config, recursively.
Returns:
-
save(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).
- filename :
-
saveToStream(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
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
Truethen do not includeimportstatements in output, this is to support human-oriented output frompipetaskwhere additional clutter is not useful.
-
setDefaults()¶ Subclass hook for computing defaults.
Notes
Derived
Configclasses that must compute defaults rather than using theFieldinstances’s defaults should do so here. To correctly use inherited defaults, implementations ofsetDefaultsmust call their base class’ssetDefaults.
-
toDict()¶ Make a dictionary of field names and their values.
Returns: See also
Notes
This method uses the
toDictmethod of individual fields. Subclasses ofFieldmay need to implement atoDictmethod for this method to work.
-
update(**kw)¶ Update values of fields specified by the keyword arguments.
Parameters: - kw
Keywords are configuration field names. Values are configuration field values.
Notes
The
__atand__labelkeyword 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 aConfiginstance’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
fieldAandfieldC:>>> 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!'
-
validate()¶ 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
validatemethods.Complex single-field validation can be defined by deriving new Field types. For convenience, some derived
lsst.pex.config.Field-types (ConfigFieldandConfigChoiceField) are defined inlsst.pex.configthat handle recursing into subconfigs.Inter-field relationships should only be checked in derived
Configclasses after calling this method, and base validation is complete.
-