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-28103: Revert changes to use subtasks from DM-24731 #446

Merged
merged 1 commit into from
Feb 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 18 additions & 19 deletions python/lsst/pipe/tasks/assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,14 +1234,6 @@ def countMaskFromFootprint(mask, footprint, bitmask, ignoreMask):
class SafeClipAssembleCoaddConfig(AssembleCoaddConfig, pipelineConnections=AssembleCoaddConnections):
"""Configuration parameters for the SafeClipAssembleCoaddTask.
"""
assembleMeanCoadd = pexConfig.ConfigurableField(
target=AssembleCoaddTask,
doc="Task to assemble an initial Coadd using the MEAN statistic.",
)
assembleMeanClipCoadd = pexConfig.ConfigurableField(
target=AssembleCoaddTask,
doc="Task to assemble an initial Coadd using the MEANCLIP statistic.",
)
clipDetection = pexConfig.ConfigurableField(
target=SourceDetectionTask,
doc="Detect sources on difference between unclipped and clipped coadd")
Expand Down Expand Up @@ -1296,10 +1288,6 @@ def setDefaults(self):
self.sigmaClip = 1.5
self.clipIter = 3
self.statistic = "MEAN"
self.assembleMeanCoadd.statistic = 'MEAN'
self.assembleMeanClipCoadd.statistic = 'MEANCLIP'
self.assembleMeanCoadd.doWrite = False
self.assembleMeanClipCoadd.doWrite = False

def validate(self):
if self.doSigmaClip:
Expand Down Expand Up @@ -1429,8 +1417,6 @@ def __init__(self, *args, **kwargs):
AssembleCoaddTask.__init__(self, *args, **kwargs)
schema = afwTable.SourceTable.makeMinimalSchema()
self.makeSubtask("clipDetection", schema=schema)
self.makeSubtask("assembleMeanClipCoadd")
self.makeSubtask("assembleMeanCoadd")

@utils.inheritDoc(AssembleCoaddTask)
@pipeBase.timeMethod
Expand Down Expand Up @@ -1514,11 +1500,24 @@ def buildDifferenceImage(self, skyInfo, tempExpRefList, imageScalerList, weightL
exp : `lsst.afw.image.Exposure`
Difference image of unclipped and clipped coadd wrapped in an Exposure
"""
coaddMean = self.assembleMeanCoadd.run(skyInfo, tempExpRefList,
imageScalerList, weightList).coaddExposure

coaddClip = self.assembleMeanClipCoadd.run(skyInfo, tempExpRefList,
imageScalerList, weightList).coaddExposure
config = AssembleCoaddConfig()
# getattr necessary because subtasks do not survive Config.toDict()
# exclude connections because the class of self.config.connections is not
# the same as AssembleCoaddConfig.connections, and the connections are not
# needed to run this task anyway.
configIntersection = {k: getattr(self.config, k)
for k, v in self.config.toDict().items()
if (k in config.keys() and k != "connections")}
config.update(**configIntersection)

# statistic MEAN copied from self.config.statistic, but for clarity explicitly assign
config.statistic = 'MEAN'
task = AssembleCoaddTask(config=config)
coaddMean = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure

config.statistic = 'MEANCLIP'
task = AssembleCoaddTask(config=config)
coaddClip = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure

coaddDiff = coaddMean.getMaskedImage().Factory(coaddMean.getMaskedImage())
coaddDiff -= coaddClip.getMaskedImage()
Expand Down
2 changes: 0 additions & 2 deletions tests/test_assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ class MockSafeClipAssembleCoaddConfig(SafeClipAssembleCoaddConfig):

def setDefaults(self):
super().setDefaults()
self.assembleMeanCoadd.retarget(MockAssembleCoaddTask)
self.assembleMeanClipCoadd.retarget(MockAssembleCoaddTask)
self.doWrite = False


Expand Down