From 77498c7434f383290fa34cc85488ef9b241b0fbe Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Wed, 17 Jul 2024 11:31:22 -0400 Subject: [PATCH] Always get from warpRef with bbox passed --- python/lsst/drp/tasks/assemble_coadd.py | 10 +++++----- tests/test_assemble_coadd.py | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/python/lsst/drp/tasks/assemble_coadd.py b/python/lsst/drp/tasks/assemble_coadd.py index 699e1c4c..00ac18b2 100644 --- a/python/lsst/drp/tasks/assemble_coadd.py +++ b/python/lsst/drp/tasks/assemble_coadd.py @@ -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") @@ -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. @@ -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 @@ -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: @@ -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() diff --git a/tests/test_assemble_coadd.py b/tests/test_assemble_coadd.py index 500c6990..855508b9 100644 --- a/tests/test_assemble_coadd.py +++ b/tests/test_assemble_coadd.py @@ -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, @@ -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)