From df291f6053c61233f89c00bf38cfa5cf9f50ad60 Mon Sep 17 00:00:00 2001 From: Eric Bellm Date: Tue, 11 Feb 2025 08:12:26 -0800 Subject: [PATCH 1/2] Remove some excluded mask planes --- python/lsst/ip/diffim/detectAndMeasure.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/python/lsst/ip/diffim/detectAndMeasure.py b/python/lsst/ip/diffim/detectAndMeasure.py index 8119f2790..9aca8de2e 100644 --- a/python/lsst/ip/diffim/detectAndMeasure.py +++ b/python/lsst/ip/diffim/detectAndMeasure.py @@ -215,10 +215,7 @@ def setDefaults(self): self.detection.reEstimateBackground = False self.detection.thresholdType = "pixel_stdev" self.detection.excludeMaskPlanes = ["EDGE", - "SAT", "BAD", - "INTRP", - "NO_DATA", ] # Copy configs for binned streak detection from the base detection task From b4257dc3e7942b9d0b67be735aeb35fc92de1fa6 Mon Sep 17 00:00:00 2001 From: Eric Bellm Date: Tue, 11 Feb 2025 08:16:23 -0800 Subject: [PATCH 2/2] Make deblending configurable --- python/lsst/ip/diffim/detectAndMeasure.py | 47 +++++++++++++++++------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/python/lsst/ip/diffim/detectAndMeasure.py b/python/lsst/ip/diffim/detectAndMeasure.py index 9aca8de2e..2c2261c49 100644 --- a/python/lsst/ip/diffim/detectAndMeasure.py +++ b/python/lsst/ip/diffim/detectAndMeasure.py @@ -125,6 +125,11 @@ class DetectAndMeasureConfig(pipeBase.PipelineTaskConfig, target=SourceDetectionTask, doc="Separate source detection used only for streak masking", ) + doDeblend = pexConfig.Field( + dtype=bool, + default=False, + doc="Deblend DIASources after detection?" + ) deblend = pexConfig.ConfigurableField( target=lsst.meas.deblender.SourceDeblendTask, doc="Task to split blended sources into their components." @@ -279,7 +284,8 @@ def __init__(self, **kwargs): self.algMetadata = dafBase.PropertyList() self.makeSubtask("detection", schema=self.schema) - self.makeSubtask("deblend", schema=self.schema) + if self.config.doDeblend: + self.makeSubtask("deblend", schema=self.schema) self.makeSubtask("setPrimaryFlags", schema=self.schema, isSingleFrame=True) self.makeSubtask("measurement", schema=self.schema, algMetadata=self.algMetadata) @@ -386,13 +392,21 @@ def run(self, science, matchedTemplate, difference, doSmooth=True, ) - sources, positives, negatives = self._deblend(difference, - results.positive, - results.negative) + if self.config.doDeblend: + sources, positives, negatives = self._deblend(difference, + results.positive, + results.negative) - return self.processResults(science, matchedTemplate, difference, sources, idFactory, - positiveFootprints=positives, - negativeFootprints=negatives) + return self.processResults(science, matchedTemplate, difference, + sources, idFactory, + positiveFootprints=positives, + negativeFootprints=negatives) + + else: + return self.processResults(science, matchedTemplate, difference, + results.sources, idFactory, + positiveFootprints=results.positive, + negativeFootprints=results.negative) def _prepareInputs(self, difference): """Ensure that we start with an empty detection and deblended mask. @@ -856,9 +870,18 @@ def run(self, science, matchedTemplate, difference, scoreExposure, # Copy the detection mask from the Score image to the difference image difference.mask.assign(scoreExposure.mask, scoreExposure.getBBox()) - sources, positives, negatives = self._deblend(difference, - results.positive, - results.negative) + if self.config.doDeblend: + sources, positives, negatives = self._deblend(difference, + results.positive, + results.negative) + + return self.processResults(science, matchedTemplate, difference, + sources, idFactory, + positiveFootprints=positives, + negativeFootprints=negatives) - return self.processResults(science, matchedTemplate, difference, sources, idFactory, - positiveFootprints=positives, negativeFootprints=negatives) + else: + return self.processResults(science, matchedTemplate, difference, + results.sources, idFactory, + positiveFootprints=results.positive, + negativeFootprints=results.negative)