Skip to content

Commit

Permalink
Update dcr_assemble_coadd to reflect required configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
abudlong committed Jan 23, 2025
1 parent a96107c commit f096fbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
14 changes: 10 additions & 4 deletions python/lsst/drp/tasks/assemble_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ def __init__(self, *, config=None):
self.outputs.remove("inputMap")

if not self.config.doWriteArtifactMasks:
self.outputs.remove("artifactMasks")
try:
self.outputs.remove("artifactMasks")
except KeyError:
pass


class AssembleCoaddConfig(
Expand Down Expand Up @@ -847,9 +850,12 @@ def assembleMetadata(self, coaddExposure, warpRefList, weightList, psfMatchedWar
coaddInputs.visits.reserve(len(warpList))

# psfMatchedWarpRefList should be empty except in CompareWarpCoadd.
if self._doUsePsfMatchedPolygons:
# Set validPolygons for warp before addVisitToCoadd
self._setValidPolygons(warpList, psfMatchedWarpRefList)
try:
if self._doUsePsfMatchedPolygons:
# Set validPolygons for warp before addVisitToCoadd
self._setValidPolygons(warpList, psfMatchedWarpRefList)
except TypeError:
pass

for warp, weight in zip(warpList, weightList):
self.inputRecorder.addVisitToCoadd(coaddInputs, warp, weight)
Expand Down
19 changes: 5 additions & 14 deletions python/lsst/drp/tasks/dcr_assemble_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class DcrAssembleCoaddConnections(
AssembleCoaddConnections,
dimensions=("tract", "patch", "band", "skymap"),
defaultTemplates={
"inputWarpName": "deep",
"inputCoaddName": "deep",
"inputWarpName": "goodSeeing",
"inputCoaddName": "goodSeeing",
"outputCoaddName": "dcr",
"warpType": "direct",
"warpTypeSuffix": "",
Expand Down Expand Up @@ -240,7 +240,7 @@ def setDefaults(self):
self.assembleStaticSkyModel.retarget(CompareWarpAssembleCoaddTask)
self.doNImage = True
self.assembleStaticSkyModel.warpType = self.warpType
# The deepCoadd and nImage files will be overwritten by this Task, so
# The goodSeeingCoadd and nImage files will be overwritten by this Task, so
# don't write them the first time.
self.assembleStaticSkyModel.doNImage = False
self.assembleStaticSkyModel.doWrite = False
Expand Down Expand Up @@ -278,7 +278,7 @@ class DcrAssembleCoaddTask(CompareWarpAssembleCoaddTask):
For full details of the mathematics and algorithm, please see
DMTN-037: DCR-matched template generation (https://dmtn-037.lsst.io).
This Task produces a DCR-corrected deepCoadd, as well as a dcrCoadd for
This Task produces a DCR-corrected goodSeeingCoadd, as well as a dcrCoadd for
each subfilter used in the iterative calculation.
It begins by dividing the bandpass-defining filter into N equal bandwidth
"subfilters", and divides the flux in each pixel from an initial coadd
Expand Down Expand Up @@ -351,9 +351,8 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):

# Construct list of input Deferred Datasets
warpRefList = inputData["inputWarps"]
psfMatchedWarpRefList = inputData["psfMatchedWarps"]

inputs = self.prepareInputs(warpRefList, psfMatchedWarpRefList)
inputs = self.prepareInputs(warpRefList, inputData["skyInfo"].bbox)
self.log.info("Found %d %s", len(inputs.warpRefList), self.getTempExpDatasetName(self.warpType))
if len(inputs.warpRefList) == 0:
self.log.warning("No coadd temporary exposures found")
Expand All @@ -365,7 +364,6 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
warpRefList=inputs.warpRefList,
imageScalerList=inputs.imageScalerList,
weightList=inputs.weightList,
psfMatchedWarpRefList=inputs.psfMatchedWarpRefList,
supplementaryData=supplementaryData,
)

Expand Down Expand Up @@ -508,7 +506,6 @@ def run(
warpRefList,
imageScalerList,
weightList,
psfMatchedWarpRefList=None,
supplementaryData=None,
**kwargs
):
Expand Down Expand Up @@ -546,9 +543,6 @@ def run(
The image scalars correct for the zero point of the exposures.
weightList : `list` [`float`]
The weight to give each input exposure in the coadd.
psfMatchedWarpRefList : `list` \
[`lsst.daf.butler.DeferredDatasetHandle`], optional
The data references to the input PSF-matched warped exposures.
supplementaryData : `lsst.pipe.base.Struct`
Result struct returned by ``_makeSupplementaryData`` with
attributes:
Expand Down Expand Up @@ -726,7 +720,6 @@ def run(
skyInfo,
warpRefList,
weightList,
psfMatchedWarpRefList=psfMatchedWarpRefList,
calibration=self.scaleZeroPoint.getPhotoCalib(),
coaddInputs=templateCoadd.getInfo().getCoaddInputs(),
mask=baseMask,
Expand Down Expand Up @@ -1126,7 +1119,6 @@ def fillCoadd(
skyInfo,
warpRefList,
weightList,
psfMatchedWarpRefList=None,
calibration=None,
coaddInputs=None,
mask=None,
Expand Down Expand Up @@ -1175,7 +1167,6 @@ def fillCoadd(
coaddExposure,
warpRefList,
weightList,
psfMatchedWarpRefList=psfMatchedWarpRefList,
)
# Overwrite the PSF
coaddExposure.setPsf(dcrModels.psf)
Expand Down

0 comments on commit f096fbe

Please sign in to comment.