From 996137f59765252450a35dd0846c988dfc354097 Mon Sep 17 00:00:00 2001 From: Clare Saunders Date: Wed, 8 Oct 2025 17:39:20 -0700 Subject: [PATCH] Preserve streaks contained by source --- python/lsst/drp/tasks/assemble_coadd.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/python/lsst/drp/tasks/assemble_coadd.py b/python/lsst/drp/tasks/assemble_coadd.py index 88fa0752..e909232c 100644 --- a/python/lsst/drp/tasks/assemble_coadd.py +++ b/python/lsst/drp/tasks/assemble_coadd.py @@ -1794,17 +1794,26 @@ def findArtifacts(self, templateCoadd, warpRefList, imageScalerList): _ = self.maskStreaks.run(warpDiffExp) streakMask = warpDiffExp.mask - spanSetStreak = afwGeom.SpanSet.fromMask( + initSpanSetStreak = afwGeom.SpanSet.fromMask( streakMask, streakMask.getPlaneBitMask(maskName) ).split() # Pad the streaks to account for low-surface brightness # wings. psf = warpDiffExp.getPsf() - for s, sset in enumerate(spanSetStreak): + spanSetStreak = [] + for sset in initSpanSetStreak: + if self.config.doPreserveContainedBySource and templateFootprints is not None: + doKeep = True + for footprint in templateFootprints.positive.getFootprints(): + if footprint.spans.contains(sset): + doKeep = False + break + if not doKeep: + continue psfShape = psf.computeShape(sset.computeCentroid()) dilation = self.config.growStreakFp * psfShape.getDeterminantRadius() sset_dilated = sset.dilated(int(dilation)) - spanSetStreak[s] = sset_dilated + spanSetStreak.append(sset_dilated) # PSF-Matched warps have less available area (~the matching # kernel) because the calexps undergo a second convolution.