Skip to content

Commit

Permalink
Revert DM-45318 that switched to original mask.
Browse files Browse the repository at this point in the history
In principle, convolution-induced mask growth may block some good sources near zeroed-out regions, so we switched to the original masked regions. Unfortunately in practice, bogus diaSources appeared near masked regions, so we are undoing this change and  living with losing some edge-y diaSources.
  • Loading branch information
mrawls committed Nov 8, 2024
1 parent ca434f2 commit 4bc87d7
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 4bc87d7

Please sign in to comment.