24__all__ = [
"GaussianPsfFactory",
"SigmaPerFwhm"]
29from ._algorithmsLib
import DoubleGaussianPsf, SingleGaussianPsf
31SigmaPerFwhm = 1.0 / (2.0 * math.sqrt(2.0 * math.log(2.0)))
39 """Factory for simple Gaussian PSF models
41 Provides a high-level interface to DoubleGaussianPsf and SingleGaussianPsf
42 by specifying Gaussian PSF model width
in FWHM instead of sigma,
43 and supporting computing kernel size
as a multiple of PSF width.
44 This makes it suitable
for tasks where PSF width
is not known
in advance.
47 doc="Kernel size (width and height) (pixels); if None then sizeFactor is used",
54 doc=
"Kernel size as a factor of fwhm (dimensionless); "
55 "size = sizeFactor * fwhm; ignored if size is not None",
62 doc=
"Minimum kernel size if using sizeFactor (pixels); ignored if size is not None",
69 doc=
"Maximum kernel size if using sizeFactor (pixels); ignored if size is not None",
76 doc=
"Default FWHM of Gaussian model of core of star (pixels)",
82 doc=
"Add a Gaussian to represent wings?",
87 wingFwhmFactor = Field(
88 doc=
"wing width, as a multiple of core width (dimensionless); ignored if addWing false",
94 wingAmplitude = Field(
95 doc=
"wing amplitude, as a multiple of core amplitude (dimensionless); ignored if addWing false",
103 """Compute kernel size and star width as sigma. The kernel size will be
104 odd unless minSize or maxSize
is used
and that value
is even. Assumes
110 FWHM of core star (pixels);
if None then defaultFwhm
is used
115 Kernel size (width == height)
in pixels
117 Sigma equivalent to supplied FWHM, assuming a Gaussian (pixels)
122 if self.
size is not None:
133 return size, fwhm * SigmaPerFwhm
136 Config.validate(self)
138 raise RuntimeError(
"minSize=%s > maxSize=%s" % (self.
minSize, self.
maxSize))
141 """Construct a GaussianPsf
146 FWHM of core of star (pixels); if None then self.
defaultFwhm is used
151 Returns
if self.
addWing is True
153 Returns
if self.
addWing is False
158 return DoubleGaussianPsf(kernelSize, kernelSize, sigma, wingsSigma, self.
wingAmplitude)
160 return SingleGaussianPsf(kernelSize, kernelSize, sigma)
164 """Make an lsst.pex.config.ConfigurableField
166 def applyWrapper(config, **kwargs):
167 """Construct a Gaussian PSF
171 config : instance of ``GaussianPsfFactory``
173 return config.apply(**kwargs)
174 return ConfigurableField(
Represent a Psf as a circularly symmetrical double Gaussian.
Represent a PSF as a circularly symmetrical Gaussian.
def apply(self, fwhm=None)
def computeSizeAndSigma(self, fwhm=None)