Skip to content

Commit

Permalink
Merge branch 'tickets/DM-47385'
Browse files Browse the repository at this point in the history
  • Loading branch information
mrawls committed Nov 9, 2024
2 parents ca434f2 + 4bc87d7 commit 7ab3e17
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions python/lsst/meas/algorithms/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True,
convolveResults = self.convolveImage(maskedImage, psf, doSmooth=doSmooth)
middle = convolveResults.middle
sigma = convolveResults.sigma
self.removeBadPixels(middle, exposure.maskedImage.mask)
self.removeBadPixels(middle)

results = self.applyThreshold(middle, maskedImage.getBBox())
results.background = background if background is not None else afwMath.BackgroundList()
Expand All @@ -799,20 +799,17 @@ def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True,

return results

def removeBadPixels(self, middle, mask):
def removeBadPixels(self, middle):
"""Set the significance of flagged pixels to zero.
Parameters
----------
middle : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage`
Convolved image to zero certain mask planes from.
middle : `lsst.afw.image.Exposure`
Score or maximum likelihood difference image.
The image plane will be modified in place.
mask : `lsst.afw.image.Mask`
Mask to select planes from to zero the image; will be restricted
to the image's bounding box.
"""
badPixelMask = mask.getPlaneBitMask(self.config.excludeMaskPlanes)
badPixels = mask.subset(middle.getBBox()).array & badPixelMask > 0
badPixelMask = middle.mask.getPlaneBitMask(self.config.excludeMaskPlanes)
badPixels = middle.mask.array & badPixelMask > 0
middle.image.array[badPixels] = 0

def setPeakSignificance(self, exposure, footprints, threshold, negative=False):
Expand Down

0 comments on commit 7ab3e17

Please sign in to comment.