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