Skip to content

Commit

Permalink
Merge pull request #64 from lsst/tickets/DM-45426
Browse files Browse the repository at this point in the history
DM-45426: Account for warps from make_direct_warp are bigger
  • Loading branch information
arunkannawadi authored Aug 14, 2024
2 parents 7f339eb + 77498c7 commit 39d8022
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions python/lsst/drp/tasks/assemble_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
else:
psfMatchedWarpRefList = []

inputs = self.prepareInputs(warpRefList, psfMatchedWarpRefList)
inputs = self.prepareInputs(warpRefList, inputData["skyInfo"].bbox, psfMatchedWarpRefList)
self.log.info("Found %d %s", len(inputs.warpRefList), self.getTempExpDatasetName(self.warpType))
if len(inputs.warpRefList) == 0:
raise pipeBase.NoWorkFound("No coadd temporary exposures found")
Expand Down Expand Up @@ -492,7 +492,7 @@ def _makeSupplementaryData(self, butlerQC, inputRefs, outputRefs):
def makeSupplementaryDataGen3(self, butlerQC, inputRefs, outputRefs):
return self._makeSupplementaryData(butlerQC, inputRefs, outputRefs)

def prepareInputs(self, refList, psfMatchedWarpRefList=None):
def prepareInputs(self, refList, coadd_bbox, psfMatchedWarpRefList=None):
"""Prepare the input warps for coaddition by measuring the weight for
each warp and the scaling for the photometric zero point.
Expand Down Expand Up @@ -547,7 +547,7 @@ def prepareInputs(self, refList, psfMatchedWarpRefList=None):

warpName = self.getTempExpDatasetName(self.warpType)
for warpRef in refList:
warp = warpRef.get()
warp = warpRef.get(parameters={"bbox": coadd_bbox})
# Ignore any input warp that is empty of data
if numpy.isnan(warp.image.array).all():
continue
Expand Down Expand Up @@ -994,7 +994,7 @@ def assembleOnlineMeanCoadd(
for warpRef, imageScaler, altMask, weight in zip(
warpRefList, imageScalerList, altMaskList, weightList
):
exposure = warpRef.get()
exposure = warpRef.get(parameters={"bbox": bbox})
maskedImage = exposure.getMaskedImage()
mask = maskedImage.getMask()
if altMask is not None:
Expand Down Expand Up @@ -1927,7 +1927,7 @@ def _readAndComputeWarpDiff(self, warpRef, imageScaler, templateCoadd):
if warpRef is None:
return None

warp = warpRef.get()
warp = warpRef.get(parameters={"bbox": templateCoadd.getBBox()})
# direct image scaler OK for PSF-matched Warp
imageScaler.scaleMaskedImage(warp.getMaskedImage())
mi = warp.getMaskedImage()
Expand Down
5 changes: 2 additions & 3 deletions tests/test_assemble_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ def runQuantum(self, mockSkyInfo, warpRefList, **kwargs):
retStruct : `lsst.pipe.base.Struct`
The coadded exposure and associated metadata.
"""
inputs = self.prepareInputs(warpRefList)

inputs = self.prepareInputs(warpRefList, mockSkyInfo.bbox)
retStruct = self.run(
mockSkyInfo,
warpRefList=inputs.warpRefList,
Expand Down Expand Up @@ -124,7 +123,7 @@ def __init__(self, *args, **kwargs):
CompareWarpAssembleCoaddTask.__init__(self, *args, **kwargs)

def runQuantum(self, mockSkyInfo, warpRefList, psfMatchedWarpRefList=None, *args):
inputs = self.prepareInputs(warpRefList, psfMatchedWarpRefList)
inputs = self.prepareInputs(warpRefList, mockSkyInfo.bbox, psfMatchedWarpRefList)

assembleStaticSkyModel = MockAssembleCoaddTask(config=self.config.assembleStaticSkyModel)
templateCoadd = assembleStaticSkyModel.runQuantum(mockSkyInfo, warpRefList)
Expand Down

0 comments on commit 39d8022

Please sign in to comment.