Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/lsst/ip/diffim/subtractImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ def footprint_mean(sources, sky=0):
footprint = record.getFootprint()
heavy = lsst.afw.detection.makeHeavyFootprint(footprint, science.maskedImage)
heavy_diff = lsst.afw.detection.makeHeavyFootprint(footprint, difference.maskedImage)
science_footprints[i] = heavy.getImageArray().sum()
difference_footprints[i] = abs(heavy_diff.getImageArray()).sum()
ratio[i] = (difference_footprints[i] - sky) / science_footprints[i]
science_footprints[i] = abs(heavy.getImageArray()).mean()
difference_footprints[i] = abs(heavy_diff.getImageArray()).mean()
ratio[i] = abs((difference_footprints[i] - sky)/science_footprints[i])
return science_footprints, difference_footprints, ratio

sky = stars["sky_source"]
Expand Down
12 changes: 7 additions & 5 deletions tests/test_subtractTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,11 @@ def test_metadata_metrics(self):
that the difference image limiting magnitude is calculated correctly,
both with a "good" and "bad" seeing template.
"""
science, sources = makeTestImage(psfSize=1.8, doApplyCalibration=True)
template_good, _ = makeTestImage(psfSize=2.4, doApplyCalibration=True)
template_bad, _ = makeTestImage(psfSize=9.5, doApplyCalibration=True)
science, sources = makeTestImage(psfSize=2.8, noiseLevel=1)
template_good, _ = makeTestImage(psfSize=2.4, doApplyCalibration=True, noiseLevel=0.25,
templateBorderSize=20)
template_bad, _ = makeTestImage(psfSize=9.5, doApplyCalibration=True, noiseLevel=0.25,
templateBorderSize=20)

# Add a few sky objects; sky footprints are needed for some metrics.
config = measAlg.SkyObjectsTask.ConfigClass()
Expand Down Expand Up @@ -968,8 +970,8 @@ def test_metadata_metrics(self):
self.assertIn('templateLimitingMagnitude', subtractTask_good.metadata)

# The mean ratio metric should be much worse on the "bad" subtraction.
self.assertLess(subtractTask_good.metadata['differenceFootprintRatioMean'], 0.2)
self.assertGreater(subtractTask_bad.metadata['differenceFootprintRatioMean'], 1.0)
self.assertLess(subtractTask_good.metadata['differenceFootprintRatioMean'], 0.02)
self.assertGreater(subtractTask_bad.metadata['differenceFootprintRatioMean'], 0.25)


class AlardLuptonPreconvolveSubtractTest(AlardLuptonSubtractTestBase, lsst.utils.tests.TestCase):
Expand Down