22__all__ = (
"ReinterpolatePixelsConfig",
"ReinterpolatePixelsTask")
34 """Config for ReinterpolatePixelsTask"""
36 maskNameList = pexConfig.ListField[str](
37 doc=
"Names of mask planes whose image-plane values should be interpolated.",
41 fallbackValue = pexConfig.Field[float](
42 doc=
"Value of last resort for interpolation. If not provided (or set to None), it is assigned the "
43 "clipped mean value of the exposure image.",
50 """Task to reinterpolate pixels"""
52 ConfigClass = ReinterpolatePixelsConfig
53 _DefaultName =
"reinterpolatePixels"
55 def run(self, exposure):
56 """Reinterpolate pixels over ``exposure``.
61 Exposure to interpolate over.
65 ``exposure`` is modified
in place
and will become the reinterpolated exposure.
69 thresh = afwDetection.Threshold(
70 mask.getPlaneBitMask(self.config.maskNameList), afwDetection.Threshold.BITMASK
72 fpSet = afwDetection.FootprintSet(mask, thresh)
77 """Compute a defect list from a footprint list.
82 Footprint list to process.
91 By using `itertools.chain.from_iterable()`, the nested iterables are merged into a flat iterable,
95 itertools.chain.from_iterable(map(Defect, afwDetection.footprintToBBoxList(fp))
for fp
in fpList)
99 """Interpolate over defects specified in a defect list.
106 List of defects to interpolate over.
110 ``exposure`` is modified
in place
and will become the reinterpolated exposure.
111 When reinterpolating following the interpolation
in ip_isr, be aware that the masks are intentionally
112 left grown
as a side-effect of that interpolation.
119 dummyPsf = afwDetection.Psf()
120 if self.config.fallbackValue
is None:
121 fallbackValue = afwMath.makeStatistics(exposure.image, afwMath.MEANCLIP).getValue()
123 fallbackValue = self.config.fallbackValue
124 if "INTRP" not in exposure.mask.getMaskPlaneDict():
125 exposure.mask.addMaskPlane(
"INTRP")
126 interpolateOverDefects(exposure.maskedImage, dummyPsf, defectList, fallbackValue,
True)
Encapsulate information about a bad portion of a detector.
_interpolateDefectList(self, exposure, defectList)
_fromFootprintList(self, fpList)