Skip to content

Commit 79af577

Browse files
committed
Add NoWorkFound for very low good pixel fraction
1 parent e602337 commit 79af577

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

python/lsst/meas/algorithms/dynamicDetection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,12 @@ def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True,
368368
nPix = maskedImage.mask.array.size
369369
badPixelMask = lsst.afw.image.Mask.getPlaneBitMask(["NO_DATA", "BAD"])
370370
nGoodPix = np.sum(maskedImage.mask.array & badPixelMask == 0)
371-
self.log.info("Number of good data pixels (i.e. not NO_DATA or BAD): {} ({:.1f}% of total)".
371+
self.log.info("Number of good data pixels (i.e. not NO_DATA or BAD): {} ({:.2f}% of total)".
372372
format(nGoodPix, 100*nGoodPix/nPix))
373+
if nGoodPix/nPix < 0.005:
374+
msg = (f"Image has a very low good pixel fraction ({nGoodPix} of {nPix}), so not worth further "
375+
"consideration.")
376+
raise pipeBase.NoWorkFound(msg)
373377

374378
with self.tempWideBackgroundContext(exposure):
375379
# Could potentially smooth with a wider kernel than the PSF in

0 commit comments

Comments
 (0)