Skip to content

Commit

Permalink
Working example of accelerated DcrModel convergence.
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed Apr 25, 2019
1 parent a87a57e commit f59c824
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions python/lsst/pipe/tasks/dcrAssembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class DcrAssembleCoaddConfig(CompareWarpAssembleCoaddConfig):
dtype=float,
doc="Maximum relative change of the model allowed between subfilters."
"Set to zero to disable.",
default=4.,
default=10.,
)
convergenceMaskPlanes = pexConfig.ListField(
dtype=str,
Expand All @@ -129,6 +129,11 @@ class DcrAssembleCoaddConfig(CompareWarpAssembleCoaddConfig):
doc="The order of the spline interpolation used to shift the image plane.",
default=3,
)
accelerateModel = pexConfig.Field(
dtype=float,
doc="Factor to amplify the differences between model planes by to speed convergence.",
default=3,
)

def setDefaults(self):
CompareWarpAssembleCoaddConfig.setDefaults(self)
Expand Down Expand Up @@ -570,7 +575,8 @@ def dcrAssembleSubregion(self, dcrModels, subExposures, bbox, dcrBBox, tempExpRe
wcs = exposure.getInfo().getWcs()
templateImage = dcrModels.buildMatchedTemplate(exposure=exposure,
order=self.config.imageInterpOrder,
splitSubfilters=self.config.splitSubfilters)
splitSubfilters=self.config.splitSubfilters,
amplifyModel=self.config.accelerateModel)
residual = exposure.image.array - templateImage.array
# Note that the variance plane here is used to store weights, not the actual variance
residual *= exposure.variance.array
Expand Down Expand Up @@ -731,7 +737,10 @@ def calculateSingleConvergence(self, dcrModels, exposure, significanceImage, sta
Quality of fit metric for one exposure, within the sub-region.
"""
convergeMask = exposure.mask.getPlaneBitMask(self.config.convergenceMaskPlanes)
templateImage = dcrModels.buildMatchedTemplate(exposure=exposure, order=self.config.imageInterpOrder)
templateImage = dcrModels.buildMatchedTemplate(exposure=exposure,
order=self.config.imageInterpOrder,
splitSubfilters=self.config.splitSubfilters,
amplifyModel=self.config.accelerateModel)
diffVals = np.abs(exposure.image.array - templateImage.array)*significanceImage
refVals = np.abs(exposure.image.array + templateImage.array)*significanceImage/2.

Expand Down Expand Up @@ -796,7 +805,9 @@ def fillCoadd(self, dcrModels, skyInfo, tempExpRefList, weightList, calibration=
the model for one subfilter.
"""
dcrCoadds = []
refModel = dcrModels.getReferenceImage()
for model in dcrModels:
model.array = (model.array - refModel)*self.config.accelerateModel + refModel
coaddExposure = afwImage.ExposureF(skyInfo.bbox, skyInfo.wcs)
if calibration is not None:
coaddExposure.setPhotoCalib(calibration)
Expand Down

0 comments on commit f59c824

Please sign in to comment.