Skip to content

Commit

Permalink
Return useful messages if PSF shape is ill-defined
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Jan 31, 2022
1 parent d27a22a commit 848de99
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 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,18 @@ def _gaussianizeAndMeasure(self, measRecord: lsst.afw.table.SourceRecord,
raise measBase.FatalAlgorithmError("No PSF in exposure")
wcs = exposure.getWcs()

psfSigma = psf.computeShape(center).getTraceRadius()
errorCollection = dict()
psfShape = psf.computeShape(center)
if not (psfShape.getDeterminantRadius() > 0):
self.log.debug("PSF shape has non-positive determinant radius at (%f, %f)", center.x, center.y)

psfSigma = psfShape.getTraceRadius()
if not (psfSigma > 0): # This captures nan
errorCollection = {str(scalingFactor): measBase.MeasurementError("PSF size could not be measured")
for scalingFactor in self.config.scalingFactor}
raise GaapConvolutionError(errorCollection)
else:
errorCollection = {}

for scalingFactor in self.config.scalingFactors:
targetSigma = scalingFactor*psfSigma
# If this target PSF is bound to fail for all apertures,
Expand Down

0 comments on commit 848de99

Please sign in to comment.