|
53 | 53 | from lsst.meas.extensions.scarlet.io import updateCatalogFootprints |
54 | 54 | from lsst.meas.astrom import DirectMatchTask, denormalizeMatches |
55 | 55 | from lsst.pipe.tasks.propagateSourceFlags import PropagateSourceFlagsTask |
56 | | -import lsst.afw.table as afwTable |
| 56 | +import lsst.afw.image as afwImage |
57 | 57 | import lsst.afw.math as afwMath |
| 58 | +import lsst.afw.table as afwTable |
58 | 59 | from lsst.daf.base import PropertyList |
59 | 60 | from lsst.skymap import BaseSkyMap |
60 | 61 |
|
@@ -315,6 +316,17 @@ def run(self, exposure, idFactory, expId, patchInfo=None): |
315 | 316 | if hasattr(detections, "background") and detections.background: |
316 | 317 | for bg in detections.background: |
317 | 318 | backgrounds.append(bg) |
| 319 | + if len(backgrounds) == 0: |
| 320 | + # Persist a constant background with value of 0.0 to get around |
| 321 | + # inability to persist empty BackgroundList. |
| 322 | + bgLevel = 0.0 |
| 323 | + bgStats = afwImage.MaskedImageF(1, 1) |
| 324 | + bgStats.set(bgLevel, 0, bgLevel) |
| 325 | + bg = afwMath.BackgroundMI(exposure.getBBox(), bgStats) |
| 326 | + bgData = (bg, afwMath.Interpolate.LINEAR, afwMath.REDUCE_INTERP_ORDER, |
| 327 | + afwMath.ApproximateControl.UNKNOWN, 0, 0, False) |
| 328 | + backgrounds.append(bgData) |
| 329 | + |
318 | 330 | return Struct(outputSources=sources, outputBackgrounds=backgrounds, outputExposure=exposure) |
319 | 331 |
|
320 | 332 | def _cropToExactBinning(self, exposure, patchInfo): |
|
0 commit comments