Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-47254: Persist subtractImages kernelSources #348

Merged
merged 2 commits into from
Oct 29, 2024
Merged
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
23 changes: 19 additions & 4 deletions python/lsst/ip/diffim/subtractImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class SubtractImageOutputConnections(lsst.pipe.base.PipelineTaskConnections,
storageClass="MatchingKernel",
name="{fakesType}{coaddName}Diff_psfMatchKernel",
)
kernelSources = connectionTypes.Output(
doc="Final selection of sources used for psf matching.",
dimensions=("instrument", "visit", "detector"),
storageClass="SourceCatalog",
name="{fakesType}{coaddName}Diff_psfMatchSources"
)


class SubtractScoreOutputConnections(lsst.pipe.base.PipelineTaskConnections,
Expand All @@ -117,6 +123,12 @@ class SubtractScoreOutputConnections(lsst.pipe.base.PipelineTaskConnections,
storageClass="MatchingKernel",
name="{fakesType}{coaddName}Diff_psfScoreMatchKernel",
)
kernelSources = connectionTypes.Output(
doc="Final selection of sources used for psf matching.",
dimensions=("instrument", "visit", "detector"),
storageClass="SourceCatalog",
name="{fakesType}{coaddName}Diff_psfScoreMatchSources"
)


class AlardLuptonSubtractConnections(SubtractInputConnections, SubtractImageOutputConnections):
Expand Down Expand Up @@ -247,7 +259,7 @@ def setDefaults(self):
self.makeKernel.kernel.active.spatialKernelOrder = 1
self.makeKernel.kernel.active.spatialBgOrder = 2
self.sourceSelector.doFlags = True
self.sourceSelector.flags.good = ["calib_psf_used",]
self.sourceSelector.flags.good = ["calib_psf_used", ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it fixes a linting warning, and is a separate commit

self.sourceSelector.doSignalToNoise = True # apply signal to noise filter
self.sourceSelector.signalToNoise.minimum = 10
self.sourceSelector.signalToNoise.maximum = 500
Expand Down Expand Up @@ -529,7 +541,8 @@ def runConvolveTemplate(self, template, science, selectSources):
matchedTemplate=matchedTemplate,
matchedScience=science,
backgroundModel=kernelResult.backgroundModel,
psfMatchingKernel=kernelResult.psfMatchingKernel)
psfMatchingKernel=kernelResult.psfMatchingKernel,
kernelSources=kernelSources)

def runConvolveScience(self, template, science, selectSources):
"""Convolve the science image with a PSF-matching kernel and subtract
Expand Down Expand Up @@ -595,7 +608,8 @@ def runConvolveScience(self, template, science, selectSources):
matchedTemplate=matchedTemplate,
matchedScience=matchedScience,
backgroundModel=kernelResult.backgroundModel,
psfMatchingKernel=kernelResult.psfMatchingKernel,)
psfMatchingKernel=kernelResult.psfMatchingKernel,
kernelSources=kernelSources)

def finalize(self, template, science, difference, kernel,
templateMatched=True,
Expand Down Expand Up @@ -1127,7 +1141,8 @@ def runPreconvolve(self, template, science, matchedScience, selectSources, preCo
matchedTemplate=matchedTemplate,
matchedScience=matchedScience,
backgroundModel=kernelResult.backgroundModel,
psfMatchingKernel=kernelResult.psfMatchingKernel)
psfMatchingKernel=kernelResult.psfMatchingKernel,
kernelSources=kernelSources)


def checkTemplateIsSufficient(templateExposure, logger, requiredTemplateFraction=0.,
Expand Down
Loading