Skip to content

Commit

Permalink
Merge pull request #23 from lsst/tickets/DM-33446
Browse files Browse the repository at this point in the history
DM-33446: Use TraceRadius in GAaP plugin
  • Loading branch information
arunkannawadi committed Feb 8, 2022
2 parents 3ff5e6c + adfaec9 commit 4777abc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions python/lsst/meas/extensions/gaap/_gaap.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,14 @@ def _gaussianizeAndMeasure(self, measRecord: lsst.afw.table.SourceRecord,
raise measBase.FatalAlgorithmError("No PSF in exposure")
wcs = exposure.getWcs()

psfSigma = psf.computeShape(center).getDeterminantRadius()
errorCollection = dict()
psfSigma = psf.computeShape(center).getTraceRadius()
if not (psfSigma > 0): # This captures NaN and negative values.
errorCollection = {str(scalingFactor): measBase.MeasurementError("PSF size could not be measured")
for scalingFactor in self.config.scalingFactor}
raise GaapConvolutionError(errorCollection)
else:
errorCollection = dict()

for scalingFactor in self.config.scalingFactors:
targetSigma = scalingFactor*psfSigma
# If this target PSF is bound to fail for all apertures,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/extensions/gaap/_gaussianizePsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def run(self, exposure: lsst.afw.image.Exposure, center: lsst.geom.Point2D, # n
result = self._buildCellSet(exposure, center, targetPsfModel)
kernelCellSet = result.kernelCellSet
targetPsfModel = result.targetPsfModel
fwhmScience = exposure.getPsf().computeShape(center).getDeterminantRadius()*sigma2fwhm
fwhmScience = exposure.getPsf().computeShape(center).getTraceRadius()*sigma2fwhm
fwhmModel = targetPsfModel.getSigma()*sigma2fwhm # This works only because it is a `GaussianPsf`.
self.log.debug("Ratio of GAaP model to science PSF = %f", fwhmModel/fwhmScience)

Expand Down

0 comments on commit 4777abc

Please sign in to comment.