Skip to content

Commit

Permalink
Revert changes to use subtasks from DM-24731
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed Feb 9, 2021
1 parent 778a6a5 commit f0dacf0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
37 changes: 18 additions & 19 deletions python/lsst/pipe/tasks/assembleCoadd.py
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
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

0 comments on commit f0dacf0

Please sign in to comment.