FgcmFitCycleConfig

class lsst.fgcmcal.FgcmFitCycleConfig(*args, **kw)

Bases: PipelineTaskConfig

Config for FgcmFitCycle

Attributes Summary

aperCorrFitNBins

Number of aperture bins used in aperture correction fit.

aperCorrInputSlopeDict

Per-band specification of aperture correction input slope parameters.

applyRefStarColorCuts

Apply color cuts defined in starColorCuts to reference stars? These cuts are in addition to any cuts defined in refStarColorCuts (bool, default True)

approxThroughputDict

Per-band specification of the approximate overall throughput at the start of calibration observations.

autoHighCutNSig

Number of sigma for automatic computation of (high) outlier cut.

autoPhotometricCutNSig

Number of sigma for automatic computation of (low) photometric cut.

bands

Bands to run calibration (List, default [])

brightObsGrayMax

Maximum gray extinction to be considered bright observation (float, default 0.15)

ccdGrayFocalPlaneChebyshevOrder

Order of the 2D chebyshev polynomials for focal plane fit.

ccdGrayFocalPlaneDict

Per-band specification on whether to compute focal-plane residual ('ccd gray') corrections.

ccdGrayFocalPlaneFitMinCcd

Minimum number of 'good' CCDs required to perform focal-plane gray corrections.

ccdGrayMaxStarErr

Maximum error on a star observation to use in ccd gray (achromatic residual) computation (float, default 0.1)

ccdGraySubCcdChebyshevOrder

Order of the 2D chebyshev polynomials for sub-ccd gray fit.

ccdGraySubCcdDict

Per-band specification on whether to compute achromatic per-ccd residual ('ccd gray') on a sub-ccd scale.

ccdGraySubCcdTriangular

Should the sub-ccd gray chebyshev matrix be triangular to suppress high-order cross terms? (bool, default True)

coatingMjds

Mirror coating dates in MJD (List, default (0.0,))

colorSplitBands

Band names to use to split stars by color.

connections

Field which refers to a dynamically added configuration class which is based on a PipelineTaskConnections class.

cycleNumber

FGCM fit cycle number.

defaultCameraOrientation

Default camera orientation for QA plots.

deltaAperFitMinNgoodObs

Minimum number of good observations to use mean delta-aper values in fits.

deltaAperFitPerCcdNx

Number of x bins per ccd when computing delta-aper background offsets.

deltaAperFitPerCcdNy

Number of y bins per ccd when computing delta-aper background offsets.

deltaAperFitSpatialNside

Healpix nside to compute spatial delta-aper background offset maps.

deltaAperInnerRadiusArcsec

Inner radius used to compute deltaMagAper (arcseconds).

deltaAperOuterRadiusArcsec

Outer radius used to compute deltaMagAper (arcseconds).

deltaMagBkgOffsetPercentile

Percentile brightest stars on a visit/ccd to use to compute net offset from local background subtraction.

deltaMagBkgPerCcd

Compute net offset from local background subtraction per-ccd? Otherwise, use computation per visit.

doComputeDeltaAperMap

Do the computation of delta-aper spatial maps? This is only used if doComputeDeltaAperPerStar is True, (bool, default False)

doComputeDeltaAperPerCcd

Do the computation of per-ccd delta-aper background offsets? (bool, default False)

doComputeDeltaAperPerStar

Do the computation of delta-aper mean values per star? (bool, default True)

doComputeDeltaAperPerVisit

Do the computation of delta-aper background offsets per visit? Note: this option can be very slow when there are many visits.

doMultipleCycles

Run multiple fit cycles in one task (bool, default False)

doPlots

Make fgcm QA plots.

doReferenceCalibration

Use reference catalog as additional constraint on calibration (bool, default True)

epochMjds

Epoch boundaries in MJD (List, default (0.0,))

expGrayErrRecoverCut

Maximum exposure gray error to be able to recover bad ccds via interpolation.

expGrayHighCutDict

Per-band specification on maximum (positive) achromatic exposure residual ('gray term') for a visit to be considered photometric.

expGrayInitialCut

Maximum exposure/visit gray value for initial selection of possible photometric observations.

expGrayPhotometricCutDict

Per-band specification on maximum (negative) achromatic exposure residual ('gray term') for a visit to be considered photometric.

expGrayRecoverCut

Maximum (negative) exposure gray to be able to recover bad ccds via interpolation.

expVarGrayPhotometricCutDict

Per-band specification on maximum exposure variance to be considered possibly photometric.

fitBands

Bands to use in atmospheric fit.

fitCcdChromaticityDict

Specification on whether to compute first-order quantum efficiency (QE) adjustments.

fitMirrorChromaticity

Fit (intraband) mirror chromatic term? (bool, default False)

focalPlaneSigmaClip

Number of sigma to clip outliers per focal-plane.

freezeStdAtmosphere

Freeze atmosphere parameters to standard (for testing) (bool, default False)

history

instrumentParsPerBand

Model instrumental parameters per band? Otherwise, instrumental parameters (QE changes with time) are shared among all bands.

instrumentSlopeMinDeltaT

Minimum time change (in days) between observations to use in constraining instrument slope.

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, default False)

latitude

Observatory latitude (float)

mapLongitudeRef

Reference longitude for plotting maps (float, default 0.0)

mapNSide

Healpix nside for plotting maps (int, default 256)

maxCcdGrayErr

Maximum error on CCD gray offset to be considered photometric (float, default 0.05)

maxIterBeforeFinalCycle

Maximum fit iterations, prior to final cycle.

minCcdPerExp

Minimum number of good CCDs per exposure/visit to be used in calibration fit.

minExpPerNight

Minimum number of good exposures/visits to consider a partly photometric night (int, default 10)

minObsPerBand

Minimum good observations per band (int, default 2)

minStarPerCcd

Minimum number of good stars per CCD to be used in calibration fit.

minStarPerExp

Minimum number of good stars per exposure/visit to be used in calibration fit.

mirrorArea

Mirror area (square meters) of telescope.

modelMagErrors

Should FGCM model the magnitude errors from sky/fwhm? (False means trust inputs) (bool, default True)

multipleCyclesFinalCycleNumber

Final cycle number in multiple cycle mode.

nCore

Number of cores to use (int, default 4)

nExpPerRun

Number of exposures to run in each chunk (int, default 1000)

nStarPerRun

Number of stars to run in each chunk (int, default 200000)

outfileBase

Filename start for plot output files (str)

outputStandardsBeforeFinalCycle

Output standard stars prior to final cycle? Used in debugging.

outputZeropointsBeforeFinalCycle

Output standard stars prior to final cycle? Used in debugging.

physicalFilterMap

Mapping from 'physicalFilter' to band.

precomputeSuperStarInitialCycle

Precompute superstar flat for initial cycle (bool, default False)

quietMode

Be less verbose with logging.

randomSeed

Random seed for fgcm for consistency in tests.

refStarColorCuts

Encoded star color cuts specifically to apply to reference stars.

refStarOutlierNSig

Number of sigma compared to average mag for reference star to be considered an outlier.

refStarSnMin

Reference star signal-to-noise minimum to use in calibration.

requiredBands

Bands that are required for a star to be considered a calibration star.

reserveFraction

Fraction of stars to reserve for testing (float, default 0.1)

saveLogOutput

Flag to enable/disable saving of log output for a task, enabled by default.

saveMetadata

Flag to enable/disable metadata saving for a task, enabled by default.

sedboundaryterms

Mapping from bands to SED boundary term names used is sedterms.

sedterms

Mapping from terms to bands for fgcm linear SED approximations.

sigFgcmMaxEGrayDict

Per-band specification for maximum (absolute) achromatic residual (gray value) for observations in sigma_fgcm (raw repeatability).

sigFgcmMaxErr

Maximum mag error for fitting sigma_FGCM (float, default 0.01)

sigma0Phot

Systematic error floor for all zeropoints (float, default 0.003)

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 (using calibration star colors).

superStarPlotCcdResiduals

If plotting is enabled, should per-detector residuals be plotted? This may produce a lot of output, and should be used only for debugging purposes.

superStarSigmaClip

Number of sigma to clip outliers when selecting for superstar flats (float, default 5.0)

superStarSubCcdChebyshevOrder

Order of the 2D chebyshev polynomials for sub-ccd superstar fit.

superStarSubCcdDict

Per-band specification on whether to compute superstar flat on sub-ccd scale.

superStarSubCcdTriangular

Should the sub-ccd superstar chebyshev matrix be triangular to suppress high-order cross terms? (bool, default False)

useExposureReferenceOffset

Use per-exposure (visit) offsets between calibrated stars and reference stars for final zeropoints? This may help uniformity for disjoint surveys.

useParquetCatalogFormat

Use parquet catalog format? (bool, default True)

useQuadraticPwv

Model PWV with a quadratic term for variation through the night? (bool, default False)

useRepeatabilityForExpGrayCutsDict

Per-band specification on whether to use star repeatability (instead of exposures) for computing photometric cuts.

utBoundary

Boundary (in UTC) from day-to-day (float)

washMjds

Mirror wash MJDs (List, default (0.0,))

Methods Summary

applyConfigOverrides(instrument, ...)

Apply config overrides to this config instance.

compare(other[, shortcut, rtol, atol, output])

Compare this configuration to another Config for 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.

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.

loadFromString(code[, root, filename, ...])

Modify this Config in place by executing the Python code in the provided string.

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.

saveToString([skipImports])

Return the Python script form of this configuration as an executable string.

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, default 10)

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 {})

applyRefStarColorCuts

Apply color cuts defined in starColorCuts to reference stars? These cuts are in addition to any cuts defined in refStarColorCuts (bool, default True)

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, default 4.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, default 3.0)

bands

Bands to run calibration (List, default [])

brightObsGrayMax

Maximum gray extinction to be considered bright observation (float, default 0.15)

ccdGrayFocalPlaneChebyshevOrder

Order of the 2D chebyshev polynomials for focal plane fit. (int, default 3)

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, default 1)

ccdGrayMaxStarErr

Maximum error on a star observation to use in ccd gray (achromatic residual) computation (float, default 0.1)

ccdGraySubCcdChebyshevOrder

Order of the 2D chebyshev polynomials for sub-ccd gray fit. (int, default 1)

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, default True)

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'))

connections: pexConfig.ConfigField

Field which refers to a dynamically added configuration class which is based on a PipelineTaskConnections class.

cycleNumber

FGCM fit cycle number. This is automatically incremented after each run and stage of outlier rejection. See cookbook for details. (int)

defaultCameraOrientation

Default camera orientation for QA plots. (float)

deltaAperFitMinNgoodObs

Minimum number of good observations to use mean delta-aper values in fits. (int, default 2)

deltaAperFitPerCcdNx

Number of x bins per ccd when computing delta-aper background offsets. Only used when doComputeDeltaAperPerCcd is True. (int, default 10)

deltaAperFitPerCcdNy

Number of y bins per ccd when computing delta-aper background offsets. Only used when doComputeDeltaAperPerCcd is True. (int, default 10)

deltaAperFitSpatialNside

Healpix nside to compute spatial delta-aper background offset maps. (int, default 64)

deltaAperInnerRadiusArcsec

Inner radius used to compute deltaMagAper (arcseconds). Must be positive and less than deltaAperOuterRadiusArcsec if any of doComputeDeltaAperPerVisit, doComputeDeltaAperPerStar, doComputeDeltaAperMap, doComputeDeltaAperPerCcd are set. (float, default 0.0)

deltaAperOuterRadiusArcsec

Outer radius used to compute deltaMagAper (arcseconds). Must be positive and greater than deltaAperInnerRadiusArcsec if any of doComputeDeltaAperPerVisit, doComputeDeltaAperPerStar, doComputeDeltaAperMap, doComputeDeltaAperPerCcd are set. (float, default 0.0)

deltaMagBkgOffsetPercentile

Percentile brightest stars on a visit/ccd to use to compute net offset from local background subtraction. (float, default 0.25)

deltaMagBkgPerCcd

Compute net offset from local background subtraction per-ccd? Otherwise, use computation per visit. (bool, default False)

doComputeDeltaAperMap

Do the computation of delta-aper spatial maps? This is only used if doComputeDeltaAperPerStar is True, (bool, default False)

doComputeDeltaAperPerCcd

Do the computation of per-ccd delta-aper background offsets? (bool, default False)

doComputeDeltaAperPerStar

Do the computation of delta-aper mean values per star? (bool, default True)

doComputeDeltaAperPerVisit

Do the computation of delta-aper background offsets per visit? Note: this option can be very slow when there are many visits. (bool, default False)

doMultipleCycles

Run multiple fit cycles in one task (bool, default False)

doPlots

Make fgcm QA plots. (bool, default True)

doReferenceCalibration

Use reference catalog as additional constraint on calibration (bool, default True)

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, default 0.05)

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)

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)

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 {})

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 [])

fitCcdChromaticityDict

Specification on whether to compute first-order quantum efficiency (QE) adjustments. Key is band, and value will be True or False. Any band not explicitly specified will default to False. (Dict, default {})

fitMirrorChromaticity

Fit (intraband) mirror chromatic term? (bool, default False)

focalPlaneSigmaClip

Number of sigma to clip outliers per focal-plane. (float, default 4.0)

freezeStdAtmosphere

Freeze atmosphere parameters to standard (for testing) (bool, default False)

history

Read-only history.

instrumentParsPerBand

Model instrumental parameters per band? Otherwise, instrumental parameters (QE changes with time) are shared among all bands. (bool, default False)

instrumentSlopeMinDeltaT

Minimum time change (in days) between observations to use in constraining instrument slope. (float, default 20.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, default False)

latitude

Observatory latitude (float)

mapLongitudeRef

Reference longitude for plotting maps (float, default 0.0)

mapNSide

Healpix nside for plotting maps (int, default 256)

maxCcdGrayErr

Maximum error on CCD gray offset to be considered photometric (float, default 0.05)

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, default 50)

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, default 5)

minExpPerNight

Minimum number of good exposures/visits to consider a partly photometric night (int, default 10)

minObsPerBand

Minimum good observations per band (int, default 2)

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, default 5)

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, default 600)

mirrorArea

Mirror area (square meters) of telescope. If not set, will try to estimate from camera.telescopeDiameter. (float, default None)

modelMagErrors

Should FGCM model the magnitude errors from sky/fwhm? (False means trust inputs) (bool, default True)

multipleCyclesFinalCycleNumber

Final cycle number in multiple cycle mode. The initial cycle is 0, with limited parameters fit. The next cycle is 1 with full parameter fit. The final cycle is a clean-up with no parameters fit. There will be a total of (multipleCycleFinalCycleNumber + 1) cycles run, and the final cycle number cannot be less than 2. (int, default 5)

Valid Range = [2,10]

nCore

Number of cores to use (int, default 4)

nExpPerRun

Number of exposures to run in each chunk (int, default 1000)

nStarPerRun

Number of stars to run in each chunk (int, default 200000)

outfileBase

Filename start for plot output files (str)

outputStandardsBeforeFinalCycle

Output standard stars prior to final cycle? Used in debugging. (bool, default False)

outputZeropointsBeforeFinalCycle

Output standard stars prior to final cycle? Used in debugging. (bool, default False)

physicalFilterMap

Mapping from ‘physicalFilter’ to band. (Dict, default {})

precomputeSuperStarInitialCycle

Precompute superstar flat for initial cycle (bool, default False)

quietMode

Be less verbose with logging. (bool, default False)

randomSeed

Random seed for fgcm for consistency in tests. (int, default None)

refStarColorCuts

Encoded star color cuts specifically to apply to reference stars. This is a list with each entry a string of the format band1,band2,low,high such that only stars of color low < band1 - band2 < high will be used as reference stars. (List, default ('NO_DATA',))

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, default 4.0)

refStarSnMin

Reference star signal-to-noise minimum to use in calibration. Set to <=0 for no cut. (float, default 50.0)

requiredBands

Bands that are required for a star to be considered a calibration star. Must be a subset of config.bands (List, default [])

reserveFraction

Fraction of stars to reserve for testing (float, default 0.1)

saveLogOutput

Flag to enable/disable saving of log output for a task, enabled by default. (bool, default True)

saveMetadata

Flag to enable/disable metadata saving for a task, enabled by default. Deprecated: This field is deprecated and will be removed after v26. (bool, default True)

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'>)

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 {})

sigFgcmMaxErr

Maximum mag error for fitting sigma_FGCM (float, default 0.01)

sigma0Phot

Systematic error floor for all zeropoints (float, default 0.003)

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 (using calibration star colors). This is a list with each entry a string of the format band1,band2,low,high such that only stars of color low < band1 - band2 < high will be used for calibration. (List, default ('NO_DATA',))

superStarPlotCcdResiduals

If plotting is enabled, should per-detector residuals be plotted? This may produce a lot of output, and should be used only for debugging purposes. (bool, default False)

superStarSigmaClip

Number of sigma to clip outliers when selecting for superstar flats (float, default 5.0)

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, default 1)

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, default False)

useExposureReferenceOffset

Use per-exposure (visit) offsets between calibrated stars and reference stars for final zeropoints? This may help uniformity for disjoint surveys. (bool, default False)

useParquetCatalogFormat

Use parquet catalog format? (bool, default True)

useQuadraticPwv

Model PWV with a quadratic term for variation through the night? (bool, 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 {})

utBoundary

Boundary (in UTC) from day-to-day (float)

washMjds

Mirror wash MJDs (List, default (0.0,))

Methods Documentation

applyConfigOverrides(instrument: Instrument | None, taskDefaultName: str, pipelineConfigs: Iterable[ConfigIR] | None, parameters: ParametersIR, label: str) None

Apply config overrides to this config instance.

Parameters:
instrumentInstrument or None

An instance of the Instrument specified in a pipeline. If None then the pipeline did not specify and instrument.

taskDefaultNamestr

The default name associated with the Task class. This may be used with instrumental overrides.

pipelineConfigsIterable of ConfigIR

An iterable of ConfigIR objects that contain overrides to apply to this config instance.

parametersParametersIR

Parameters defined in a Pipeline which are used in formatting of config values across multiple Task in a pipeline.

labelstr

The label associated with this class’s Task in a pipeline.

compare(other, shortcut=True, rtol=1e-08, atol=1e-08, output=None)

Compare this configuration to another Config for equality.

Parameters:
otherlsst.pex.config.Config

Other Config object to compare against this config.

shortcutbool, optional

If True, return as soon as an inequality is found. Default is True.

rtolfloat, optional

Relative tolerance for floating point comparisons.

atolfloat, optional

Absolute tolerance for floating point comparisons.

outputcallable, optional

A callable that takes a string, used (possibly repeatedly) to report inequalities.

Returns:
isEqualbool

True when the two lsst.pex.config.Config instances are equal. False if there is an inequality.

Notes

Unselected targets of RegistryField fields and unselected choices of ConfigChoiceField fields are not considered by this method.

Floating point comparisons are performed by numpy.allclose.

formatHistory(name, **kwargs)

Format a configuration field’s history to a human-readable format.

Parameters:
namestr

Name of a Field in this config.

kwargs

Keyword arguments passed to lsst.pex.config.history.format.

Returns:
historystr

A string containing the formatted history.

freeze()

Make this config, and all subconfigs, read-only.

items()

Get configurations as (field name, field value) pairs.

Returns:
itemsItemsView

Iterator of tuples for each configuration. Tuple items are:

  1. Field name.

  2. Field value.

keys()

Get field names.

Returns:
namesKeysView

List of lsst.pex.config.Field names.

load(filename, root='config')

Modify this config in place by executing the Python code in a configuration file.

Parameters:
filenamestr

Name of the configuration file. A configuration file is Python module.

rootstr, 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.

loadFromStream(stream, root='config', filename=None, extraLocals=None)

Modify this Config in place by executing the Python code in the provided stream.

Parameters:
streamfile-like object, str, bytes, or compiled string

Stream containing configuration override code. If this is a code object, it should be compiled with mode="exec".

rootstr, 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.

filenamestr, optional

Name of the configuration file, or None if unknown or contained in the stream. Used for error reporting.

extraLocalsdict 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.

loadFromString(code, root='config', filename=None, extraLocals=None)

Modify this Config in place by executing the Python code in the provided string.

Parameters:
codestr, bytes, or compiled string

Stream containing configuration override code.

rootstr, 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.

filenamestr, optional

Name of the configuration file, or None if unknown or contained in the stream. Used for error reporting.

extraLocalsdict 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.

names()

Get all the field names in the config, recursively.

Returns:
nameslist of str

Field names.

save(filename, root='config')

Save a Python script to the named file, which, when loaded, reproduces this config.

Parameters:
filenamestr

Desination filename of this configuration.

rootstr, optional

Name to use for the root config variable. The same value must be used when loading (see lsst.pex.config.Config.load).

saveToStream(outfile, root='config', skipImports=False)

Save a configuration file to a stream, which, when loaded, reproduces this config.

Parameters:
outfilefile-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).

skipImportsbool, 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.

saveToString(skipImports=False)

Return the Python script form of this configuration as an executable string.

Parameters:
skipImportsbool, 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:
codestr

A code string readable by loadFromString.

setDefaults()

Subclass hook for computing defaults.

Notes

Derived Config classes that must compute defaults rather than using the Field instances’s defaults should do so here. To correctly use inherited defaults, implementations of setDefaults must call their base class’s setDefaults.

toDict()

Make a dictionary of field names and their values.

Returns:
dict_dict

Dictionary with keys that are Field names. Values are Field values.

Notes

This method uses the toDict method of individual fields. Subclasses of Field may need to implement a toDict method 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 __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 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!'
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 validate methods.

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

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

values()

Get field values.

Returns:
valuesValuesView

Iterator of field values.