36 """Configuration parameters for CoaddBaseTask
38 Configuration parameters shared between MakeCoaddTempExp and AssembleCoadd
41 coaddName = pexConfig.Field(
42 doc=
"Coadd name: typically one of deep or goodSeeing.",
46 select = pexConfig.ConfigurableField(
47 doc=
"Image selection subtask.",
48 target=PsfWcsSelectImagesTask,
50 badMaskPlanes = pexConfig.ListField(
52 doc=
"Mask planes that, if set, the associated pixel should not be included in the coaddTempExp.",
55 inputRecorder = pexConfig.ConfigurableField(
56 doc=
"Subtask that helps fill CoaddInputs catalogs added to the final Exposure",
57 target=CoaddInputRecorderTask
59 doPsfMatch = pexConfig.Field(
61 doc=
"Match to modelPsf? Sets makePsfMatched=True, makeDirect=False",
62 deprecated=
"This field is no longer used. Will be removed after v26.",
65 modelPsf = measAlg.GaussianPsfFactory.makeField(doc=
"Model Psf factory")
66 doApplyExternalPhotoCalib = pexConfig.Field(
69 doc=(
"Whether to apply external photometric calibration via an "
70 "`lsst.afw.image.PhotoCalib` object. Uses the "
71 "`externalPhotoCalibName` field to determine which calibration "
74 deprecated=
"Deprecated in favor of the 'visitSummary' connection. Will be removed after v26.",
76 useGlobalExternalPhotoCalib = pexConfig.Field(
79 doc=(
"When using doApplyExternalPhotoCalib, use 'global' calibrations "
80 "that are not run per-tract. When False, use per-tract photometric "
81 "calibration files."),
83 deprecated=
"Deprecated in favor of the 'visitSummary' connection. Will be removed after v26.",
85 doApplyExternalSkyWcs = pexConfig.Field(
88 doc=(
"Whether to apply external astrometric calibration via an "
89 "`lsst.afw.geom.SkyWcs` object. Uses `externalSkyWcsName` "
90 "field to determine which calibration to load."),
92 deprecated=
"Deprecated in favor of the 'visitSummary' connection. Will be removed after v26.",
94 useGlobalExternalSkyWcs = pexConfig.Field(
97 doc=(
"When using doApplyExternalSkyWcs, use 'global' calibrations "
98 "that are not run per-tract. When False, use per-tract wcs "
101 deprecated=
"Deprecated in favor of the 'visitSummary' connection. Will be removed after v26.",
103 includeCalibVar = pexConfig.Field(
105 doc=
"Add photometric calibration variance to warp variance plane.",
108 matchingKernelSize = pexConfig.Field(
110 doc=
"Size in pixels of matching kernel. Must be odd.",
112 check=
lambda x: x % 2 == 1
150 """Constructs SkyInfo used by coaddition tasks for multiple
155 skyMap : `lsst.skyMap.SkyMap`
159 patchId : `str` or `int` or `tuple` of `int`
160 Either Gen2-style comma delimited string (e.g. '4,5'),
161 tuple of integers (e.g (4, 5), Gen3-style integer.
165 makeSkyInfo : `lsst.pipe.base.Struct`
166 pipe_base Struct with attributes:
169 Sky map (`lsst.skyMap.SkyMap`).
171 Information for chosen tract of sky map (`lsst.skyMap.TractInfo`).
173 Information about chosen patch of tract (`lsst.skyMap.PatchInfo`).
175 WCS of tract (`lsst.afw.image.SkyWcs`).
177 Outer bbox of patch, as an geom Box2I (`lsst.afw.geom.Box2I`).
179 tractInfo = skyMap[tractId]
181 if isinstance(patchId, str)
and ',' in patchId:
183 patchIndex = tuple(int(i)
for i
in patchId.split(
","))
187 patchInfo = tractInfo.getPatchInfo(patchIndex)
189 return pipeBase.Struct(
193 wcs=tractInfo.getWcs(),
194 bbox=patchInfo.getOuterBBox(),
198def scaleVariance(maskedImage, maskPlanes, log=None):
199 """Scale the variance in a maskedImage
201 This is deprecated. Use the ScaleVarianceTask instead.
205 maskedImage : `lsst.afw.image.MaskedImage`
206 MaskedImage to operate on; variance will be scaled.
208 List of mask planes for pixels to reject.
210 Log for reporting the renormalization factor; or None.
215 Renormalization factor.
219 The variance plane in a convolved or warped image (or a coadd derived
220 from warped images) does not accurately reflect the noise properties of
221 the image because variance has been lost to covariance. This function
222 attempts to correct for this by scaling the variance plane to match
223 the observed variance in the image. This is not perfect (because we're
224 not tracking the covariance) but it's simple and is often good enough.
226 config = ScaleVarianceTask.ConfigClass()
227 config.maskPlanes = maskPlanes
228 task = ScaleVarianceTask(config=config, name=
"scaleVariance", log=log)
229 return task.run(maskedImage)
262 """Iterate over subregions of a bbox.
266 bbox : `lsst.geom.Box2I`
267 Bounding box over which to iterate.
268 subregionSize : `lsst.geom.Extent2I`
273 subBBox : `lsst.geom.Box2I`
274 Next sub-bounding box of size ``subregionSize`` or smaller; each ``subBBox``
275 is contained within ``bbox``, so it may be smaller than ``subregionSize`` at
276 the edges of ``bbox``, but it will never be empty.
281 Raised if any of the following occur:
282 - The given bbox is empty.
283 - The subregionSize is 0.
286 raise RuntimeError(
"bbox %s is empty" % (bbox,))
287 if subregionSize[0] < 1
or subregionSize[1] < 1:
288 raise RuntimeError(
"subregionSize %s must be nonzero" % (subregionSize,))
290 for rowShift
in range(0, bbox.getHeight(), subregionSize[1]):
291 for colShift
in range(0, bbox.getWidth(), subregionSize[0]):
294 if subBBox.isEmpty():
295 raise RuntimeError(
"Bug: empty bbox! bbox=%s, subregionSize=%s, "
296 "colShift=%s, rowShift=%s" %
297 (bbox, subregionSize, colShift, rowShift))