35 """Configuration parameters for CoaddBaseTask
37 Configuration parameters shared between MakeCoaddTempExp and AssembleCoadd
40 coaddName = pexConfig.Field(
41 doc=
"Coadd name: typically one of deep or goodSeeing.",
45 select = pexConfig.ConfigurableField(
46 doc=
"Image selection subtask.",
47 target=PsfWcsSelectImagesTask,
49 badMaskPlanes = pexConfig.ListField(
51 doc=
"Mask planes that, if set, the associated pixel should not be included in the coaddTempExp.",
54 inputRecorder = pexConfig.ConfigurableField(
55 doc=
"Subtask that helps fill CoaddInputs catalogs added to the final Exposure",
56 target=CoaddInputRecorderTask
58 includeCalibVar = pexConfig.Field(
60 doc=
"Add photometric calibration variance to warp variance plane.",
63 matchingKernelSize = pexConfig.Field(
65 doc=
"Size in pixels of matching kernel. Must be odd.",
67 check=
lambda x: x % 2 == 1
105 """Constructs SkyInfo used by coaddition tasks for multiple
110 skyMap : `lsst.skyMap.SkyMap`
114 patchId : `str` or `int` or `tuple` of `int`
115 Either Gen2-style comma delimited string (e.g. '4,5'),
116 tuple of integers (e.g (4, 5), Gen3-style integer.
120 makeSkyInfo : `lsst.pipe.base.Struct`
121 pipe_base Struct with attributes:
124 Sky map (`lsst.skyMap.SkyMap`).
126 Information for chosen tract of sky map (`lsst.skyMap.TractInfo`).
128 Information about chosen patch of tract (`lsst.skyMap.PatchInfo`).
130 WCS of tract (`lsst.afw.image.SkyWcs`).
132 Outer bbox of patch, as an geom Box2I (`lsst.afw.geom.Box2I`).
134 tractInfo = skyMap[tractId]
136 if isinstance(patchId, str)
and ',' in patchId:
138 patchIndex = tuple(int(i)
for i
in patchId.split(
","))
142 patchInfo = tractInfo.getPatchInfo(patchIndex)
144 return pipeBase.Struct(
148 wcs=tractInfo.getWcs(),
149 bbox=patchInfo.getOuterBBox(),
153def scaleVariance(maskedImage, maskPlanes, log=None):
154 """Scale the variance in a maskedImage
156 This is deprecated. Use the ScaleVarianceTask instead.
160 maskedImage : `lsst.afw.image.MaskedImage`
161 MaskedImage to operate on; variance will be scaled.
163 List of mask planes for pixels to reject.
165 Log for reporting the renormalization factor; or None.
170 Renormalization factor.
174 The variance plane in a convolved or warped image (or a coadd derived
175 from warped images) does not accurately reflect the noise properties of
176 the image because variance has been lost to covariance. This function
177 attempts to correct for this by scaling the variance plane to match
178 the observed variance in the image. This is not perfect (because we're
179 not tracking the covariance) but it's simple and is often good enough.
181 config = ScaleVarianceTask.ConfigClass()
182 config.maskPlanes = maskPlanes
183 task = ScaleVarianceTask(config=config, name=
"scaleVariance", log=log)
184 return task.run(maskedImage)
217 """Iterate over subregions of a bbox.
221 bbox : `lsst.geom.Box2I`
222 Bounding box over which to iterate.
223 subregionSize : `lsst.geom.Extent2I`
228 subBBox : `lsst.geom.Box2I`
229 Next sub-bounding box of size ``subregionSize`` or smaller; each ``subBBox``
230 is contained within ``bbox``, so it may be smaller than ``subregionSize`` at
231 the edges of ``bbox``, but it will never be empty.
236 Raised if any of the following occur:
237 - The given bbox is empty.
238 - The subregionSize is 0.
241 raise RuntimeError(
"bbox %s is empty" % (bbox,))
242 if subregionSize[0] < 1
or subregionSize[1] < 1:
243 raise RuntimeError(
"subregionSize %s must be nonzero" % (subregionSize,))
245 for rowShift
in range(0, bbox.getHeight(), subregionSize[1]):
246 for colShift
in range(0, bbox.getWidth(), subregionSize[0]):
249 if subBBox.isEmpty():
250 raise RuntimeError(
"Bug: empty bbox! bbox=%s, subregionSize=%s, "
251 "colShift=%s, rowShift=%s" %
252 (bbox, subregionSize, colShift, rowShift))