65 def run(self, exposure):
66 """Set exposure's PSF to a simple PSF model
68 The sigma and width of the new simple PSF model matches the sigma and
69 width of the current model, if any, else the config parameters are used.
73 exposure : `lsst.afw.image.Exposure`
74 Exposure in which to replace or add the PSF model.
77 psfModel = exposure.getPsf()
78 psfSigma = psfModel.computeShape(psfModel.getAveragePosition()).getDeterminantRadius()
79 if math.isnan(psfSigma):
80 raise RuntimeError(
"Cannot create a Gaussian PSF model. "
81 "The computed exposure psfSigma is NaN!")
82 width, height = psfModel.computeImage(psfModel.getAveragePosition()).getDimensions()
84 psfSigma = self.config.fwhm / FwhmPerSigma
85 width = height = self.config.width
88 raise RuntimeError(
"psfSigma = %s <= 0" % (psfSigma,))
90 self.log.debug(
"installing a simple Gaussian PSF model with width=%s, height=%s, FWHM=%0.3f",
91 width, height, psfSigma*FwhmPerSigma)
93 exposure.setPsf(psfModel)