Skip to content

Commit

Permalink
Merge pull request #638 from lsst/tickets/DM-33822
Browse files Browse the repository at this point in the history
DM-33822 Fix WCS bug in DCR templates
  • Loading branch information
isullivan committed Mar 1, 2022
2 parents 5d7e2d8 + 5d9b609 commit 84bf843
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions python/lsst/pipe/tasks/dcrAssembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ def prepareDcrInputs(self, templateCoadd, warpRefList, weightList):
self.config.dcrNumSubfilters,
effectiveWavelength=self.config.effectiveWavelength,
bandwidth=self.config.bandwidth,
wcs=templateCoadd.getWcs(),
filterLabel=filterLabel,
psf=psf)
return dcrModels
Expand Down Expand Up @@ -852,6 +853,7 @@ def dcrAssembleSubregion(self, dcrModels, subExposures, bbox, dcrBBox, warpRefLi
visitInfo = exposure.getInfo().getVisitInfo()
wcs = exposure.getInfo().getWcs()
templateImage = dcrModels.buildMatchedTemplate(exposure=exposure,
bbox=exposure.getBBox(),
order=self.config.imageInterpOrder,
splitSubfilters=self.config.splitSubfilters,
splitThreshold=self.config.splitThreshold,
Expand Down Expand Up @@ -891,9 +893,13 @@ def dcrResiduals(self, residual, visitInfo, wcs, effectiveWavelength, bandwidth)
residualImage : `numpy.ndarray`
The residual image for the next subfilter, shifted for DCR.
"""
# Pre-calculate the spline-filtered residual image, so that step can be
# skipped in the shift calculation in `applyDcr`.
filteredResidual = ndimage.spline_filter(residual, order=self.config.imageInterpOrder)
if self.config.imageInterpOrder > 1:
# Pre-calculate the spline-filtered residual image, so that step can be
# skipped in the shift calculation in `applyDcr`.
filteredResidual = ndimage.spline_filter(residual, order=self.config.imageInterpOrder)
else:
# No need to prefilter if order=1 (it will also raise an error)
filteredResidual = residual
# Note that `splitSubfilters` is always turned off in the reverse direction.
# This option introduces additional blurring if applied to the residuals.
dcrShift = calculateDcr(visitInfo, wcs, effectiveWavelength, bandwidth, self.config.dcrNumSubfilters,
Expand Down Expand Up @@ -1023,6 +1029,7 @@ def calculateSingleConvergence(self, dcrModels, exposure, significanceImage, sta
"""
convergeMask = exposure.mask.getPlaneBitMask(self.config.convergenceMaskPlanes)
templateImage = dcrModels.buildMatchedTemplate(exposure=exposure,
bbox=exposure.getBBox(),
order=self.config.imageInterpOrder,
splitSubfilters=self.config.splitSubfilters,
splitThreshold=self.config.splitThreshold,
Expand Down

0 comments on commit 84bf843

Please sign in to comment.