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

Remove use of deprecated PsfAttributes #67

Merged
merged 2 commits into from
Jun 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 2 additions & 9 deletions examples/runSubtractExposures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import lsst.afw.image as afwImage
import lsst.log.utils as logUtils
import lsst.meas.algorithms as measAlg

import lsst.ip.diffim as ipDiffim
import lsst.ip.diffim.diffimTools as diffimTools
Expand Down Expand Up @@ -79,21 +78,15 @@ def getArg(ind, defValue):
fwhmS = defFwhm
if options.fwhmS:
if scienceExposure.hasPsf():
width, height = scienceExposure.getPsf().getKernel().getDimensions()
psfAttr = measAlg.PsfAttributes(scienceExposure.getPsf(), width//2, height//2)
s = psfAttr.computeGaussianWidth(psfAttr.ADAPTIVE_MOMENT) # gaussian sigma in pixels
fwhm = s * sigma2fwhm
fwhm = scienceExposure.getPsf().computeShape().getDeterminantRadius() * sigma2fwhm
print('NOTE: Embedded Psf has FwhmS =', fwhm)
print('USING: FwhmS =', options.fwhmS)
fwhmS = options.fwhmS

fwhmT = defFwhm
if options.fwhmT:
if templateExposure.hasPsf():
width, height = templateExposure.getPsf().getKernel().getDimensions()
psfAttr = measAlg.PsfAttributes(templateExposure.getPsf(), width//2, height//2)
s = psfAttr.computeGaussianWidth(psfAttr.ADAPTIVE_MOMENT) # gaussian sigma in pixels
fwhm = s * sigma2fwhm
fwhm = templateExposure.getPsf().computeShape().getDeterminantRadius() * sigma2fwhm
print('NOTE: Embedded Psf has FwhmT =', fwhm)
print('USING: FwhmT =', options.fwhmT)
fwhmT = options.fwhmT
Expand Down
14 changes: 4 additions & 10 deletions python/lsst/ip/diffim/modelPsfMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.log as log
import lsst.meas.algorithms as measAlg
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
from .makeKernelBasisList import makeKernelBasisList
Expand Down Expand Up @@ -299,15 +298,10 @@ def run(self, exposure, referencePsfModel, kernelSum=1.0):
result = self._buildCellSet(exposure, referencePsfModel)
kernelCellSet = result.kernelCellSet
referencePsfModel = result.referencePsfModel
width, height = referencePsfModel.getLocalKernel().getDimensions()
psfAttr1 = measAlg.PsfAttributes(exposure.getPsf(), width//2, height//2)
psfAttr2 = measAlg.PsfAttributes(referencePsfModel, width//2, height//2)
s1 = psfAttr1.computeGaussianWidth(psfAttr1.ADAPTIVE_MOMENT) # gaussian sigma in pixels
s2 = psfAttr2.computeGaussianWidth(psfAttr2.ADAPTIVE_MOMENT) # gaussian sigma in pixels
fwhm1 = s1 * sigma2fwhm # science Psf
fwhm2 = s2 * sigma2fwhm # template Psf

basisList = makeKernelBasisList(self.kConfig, fwhm1, fwhm2, metadata=self.metadata)
fwhmScience = exposure.getPsf().computeShape().getDeterminantRadius() * sigma2fwhm
fwhmModel = referencePsfModel.computeShape().getDeterminantRadius() * sigma2fwhm

basisList = makeKernelBasisList(self.kConfig, fwhmScience, fwhmModel, metadata=self.metadata)
spatialSolution, psfMatchingKernel, backgroundModel = self._solve(kernelCellSet, basisList)

if psfMatchingKernel.isSpatiallyVarying():
Expand Down