Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the PSF-matched coadd's PSF to the model PSF used #110

Merged
merged 1 commit into from
Apr 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion python/lsst/pipe/tasks/assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,13 @@ def assembleMetadata(self, coaddExposure, tempExpRefList, weightList):
self.inputRecorder.addVisitToCoadd(coaddInputs, tempExp, weight)
coaddInputs.visits.sort()
if self.config.doPsfMatch:
psf = self.config.modelPsf.apply()
# The modelPsf BBox for a psfMatchedWarp/coaddTempExp was dynamically defined by
# ModelPsfMatchTask as the square box bounding its spatially-variable, pre-matched WarpedPsf.
# Likewise, set the PSF of a PSF-Matched Coadd to the modelPsf
# having the maximum width (sufficient because square)
modelPsfList = [tempExp.getPsf() for tempExp in tempExpList]
modelPsfWidthList = [modelPsf.computeBBox().getWidth() for modelPsf in modelPsfList]
psf = modelPsfList[modelPsfWidthList.index(max(modelPsfWidthList))]
else:
psf = measAlg.CoaddPsf(coaddInputs.ccds, coaddExposure.getWcs())
coaddExposure.setPsf(psf)
Expand Down
7 changes: 4 additions & 3 deletions python/lsst/pipe/tasks/makeCoaddTempExp.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,17 @@ def createTempExp(self, calexpRefList, skyInfo, visitId=0):
if numGoodPix > 0 and not didSetMetadata:
coaddTempExp.setCalib(exposure.getCalib())
coaddTempExp.setFilter(exposure.getFilter())
# PSF replaced with CoaddPsf after loop if and only if creating direct warp
coaddTempExp.setPsf(exposure.getPsf())
didSetMetadata = True
except Exception as e:
self.log.warn("Error processing calexp %s; skipping it: %s", calExpRef.dataId, e)
continue
inputRecorder.addCalExp(calExp, ccdId, numGoodPix)

inputRecorder.finish(coaddTempExp, totGoodPix)
if totGoodPix > 0 and didSetMetadata:
coaddTempExp.setPsf(modelPsf if self.config.doPsfMatch else
CoaddPsf(inputRecorder.coaddInputs.ccds, skyInfo.wcs))
if totGoodPix > 0 and didSetMetadata and not self.config.doPsfMatch:
coaddTempExp.setPsf(CoaddPsf(inputRecorder.coaddInputs.ccds, skyInfo.wcs))

self.log.info("coaddTempExp has %d good pixels (%.1f%%)",
totGoodPix, 100.0*totGoodPix/skyInfo.bbox.getArea())
Expand Down