LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | List of all members
lsst::meas::modelfit::GeneralPsfFitter Class Reference

Class for fitting multishapelet models to PSF images. More...

#include <GeneralPsfFitter.h>

Inheritance diagram for lsst::meas::modelfit::GeneralPsfFitter:
lsst::meas::modelfit::GeneralPsfFitterAlgorithm

Public Member Functions

 GeneralPsfFitter (GeneralPsfFitterControl const &ctrl)
 Initialize the fitter class with the given control object. More...
 
shapelet::MultiShapeletFunctionKey addFields (afw::table::Schema &schema, std::string const &prefix) const
 Add fields to a Schema that can be used to store the MultiShapeletFunction returned by apply(). More...
 
std::shared_ptr< ModelgetModel () const
 Return the Model object that corresponds to the configuration. More...
 
std::shared_ptr< PriorgetPrior () const
 Return the Prior object that corresponds to the configuration. More...
 
shapelet::MultiShapeletFunction adapt (shapelet::MultiShapeletFunction const &previousFit, std::shared_ptr< Model > previousModel) const
 Adapt a differently-configured previous fit to be used as an starting point for this GeneralPsfFitter. More...
 
shapelet::MultiShapeletFunction apply (afw::image::Image< Pixel > const &image, afw::geom::ellipses::Quadrupole const &moments, Scalar noiseSigma=-1, int *pState=nullptr) const
 Perform an initial fit to a PSF image. More...
 
shapelet::MultiShapeletFunction apply (afw::image::Image< double > const &image, afw::geom::ellipses::Quadrupole const &moments, Scalar noiseSigma=-1, int *pState=nullptr) const
 
shapelet::MultiShapeletFunction apply (afw::image::Image< Pixel > const &image, shapelet::MultiShapeletFunction const &initial, Scalar noiseSigma=-1, int *pState=nullptr) const
 Perform a fit to a PSF image, using a previous fit as a starting point. More...
 
shapelet::MultiShapeletFunction apply (afw::image::Image< double > const &image, shapelet::MultiShapeletFunction const &initial, Scalar noiseSigma=-1, int *pState=nullptr) const
 

Detailed Description

Class for fitting multishapelet models to PSF images.

This class fits up to four shapelet expansions simultaneously to a PSF image, with the relative radii and number of shapelet coefficients for each expansion separately configurable. These expansions are also named; this allows us to map different fits with some expansions disabled to each other, in order to first fit an approximate model and follow this up with a more complete model, using the approximate model as a starting point.

The configuration also defines a simple Bayesian prior for the fit, defined using simple independent Gaussians for the ellipse parameters of each component. The priors can be disabled by setting their width (xxPriorSigma in the control object) to infinity, and those parameters can be held fixed at their input values by setting the prior width to zero. The priors are always centered at the input value, meaning that it may be more appropriate to think of the priors as a form of regularization, rather than a rigorous prior. In fact, it's impossible to use a prior here rigorously without a noise model for the PSF image, which is something the LSST Psf class doesn't provide, and here is just provided as a constant noise sigma to be provided by the user (who generally just has to chose a small number arbitrarily). Decreasing the noise sigma will of course decrease the effect of the priors (and vice versa). In any case, having some sort of regularization is probably a good idea, as this is a very high-dimensional fit.

Definition at line 148 of file GeneralPsfFitter.h.

Constructor & Destructor Documentation

◆ GeneralPsfFitter()

lsst::meas::modelfit::GeneralPsfFitter::GeneralPsfFitter ( GeneralPsfFitterControl const &  ctrl)
explicit

Initialize the fitter class with the given control object.

Member Function Documentation

◆ adapt()

shapelet::MultiShapeletFunction lsst::meas::modelfit::GeneralPsfFitter::adapt ( shapelet::MultiShapeletFunction const &  previousFit,
std::shared_ptr< Model previousModel 
) const

Adapt a differently-configured previous fit to be used as an starting point for this GeneralPsfFitter.

Parameters
[in]previousFitThe return value of apply() from a differently-configured instance of GeneralPsfFitter.
[in]previousModelThe Model associated with the GeneralPsfFitter used to create previousFit.
Returns
a new MultiShapelet function that may be passed directly to apply(). When possible, the ellipse and shapelet coefficeints will be copied from previousFit; higher-order coefficients will be set to zero, and any components used in this but unused in the previous fit will have their ellipses set relative to the previous fit's "primary" component.

◆ addFields()

shapelet::MultiShapeletFunctionKey lsst::meas::modelfit::GeneralPsfFitter::addFields ( afw::table::Schema schema,
std::string const &  prefix 
) const

Add fields to a Schema that can be used to store the MultiShapeletFunction returned by apply().

Parameters
[in,out]schemaSchema to add fields to.
[in]prefixField name prefix for all fields.
Returns
a FunctorKey that can get/set MultiShapeletFunctions that match the configuration of this fitter on a record.

◆ apply() [1/4]

shapelet::MultiShapeletFunction lsst::meas::modelfit::GeneralPsfFitter::apply ( afw::image::Image< double > const &  image,
afw::geom::ellipses::Quadrupole const &  moments,
Scalar  noiseSigma = -1,
int *  pState = nullptr 
) const
inline

Definition at line 221 of file GeneralPsfFitter.h.

226  {
227  return apply(afw::image::Image<float>(image, true), moments, noiseSigma, pState);
228  }
shapelet::MultiShapeletFunction apply(afw::image::Image< Pixel > const &image, afw::geom::ellipses::Quadrupole const &moments, Scalar noiseSigma=-1, int *pState=nullptr) const
Perform an initial fit to a PSF image.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
VectorQ moments
Definition: simpleShape.cc:151

◆ apply() [2/4]

shapelet::MultiShapeletFunction lsst::meas::modelfit::GeneralPsfFitter::apply ( afw::image::Image< double > const &  image,
shapelet::MultiShapeletFunction const &  initial,
Scalar  noiseSigma = -1,
int *  pState = nullptr 
) const
inline

Definition at line 251 of file GeneralPsfFitter.h.

256  {
257  return apply(afw::image::Image<float>(image, true), initial, noiseSigma);
258  }

◆ apply() [3/4]

shapelet::MultiShapeletFunction lsst::meas::modelfit::GeneralPsfFitter::apply ( afw::image::Image< Pixel > const &  image,
afw::geom::ellipses::Quadrupole const &  moments,
Scalar  noiseSigma = -1,
int *  pState = nullptr 
) const

Perform an initial fit to a PSF image.

Parameters
[in]imageThe image to fit, typically the result of Psf::computeKernelImage(). The image's xy0 should be set such that the center of the PSF is at (0,0).
[in]momentsSecond moments of the PSF, typically result of Psf::computeShape() or running some other adaptive moments code on the PSF image. This will be used to set the initial ellipses of the multishapelet model.
[in]noiseSigmaAn estimate of the noise in the image. As LSST PSF images are generally assumed to be noise-free, this is really just a fiddle-factor for the user. A default value from the control object is used if this is negative.
[in]pStatePointer to an integer which is used to return the optimizerState from apply.

◆ apply() [4/4]

shapelet::MultiShapeletFunction lsst::meas::modelfit::GeneralPsfFitter::apply ( afw::image::Image< Pixel > const &  image,
shapelet::MultiShapeletFunction const &  initial,
Scalar  noiseSigma = -1,
int *  pState = nullptr 
) const

Perform a fit to a PSF image, using a previous fit as a starting point.

Parameters
[in]imageThe image to fit, typically the result of Psf::computeKernelImage(). The image's xy0 should be set such that the center of the PSF is at (0,0).
[in]initialThe result of a previous call to apply(), using an identically-configured GeneralPsfFitter instance. To use a result from a differently-configured GeneralPsfFitter, use adapt().
[in]noiseSigmaAn estimate of the noise in the image. As LSST PSF images are generally assumed to be noise-free, this is really just a fiddle-factor for the user. A default value from the control object is used if this is negative.
[in]pStatePointer to an integer which is used to return the optimizerState from apply.

◆ getModel()

std::shared_ptr<Model> lsst::meas::modelfit::GeneralPsfFitter::getModel ( ) const
inline

Return the Model object that corresponds to the configuration.

In addition to the shapelet coefficients (stored in the "amplitudes" array), this Model stores all the initial ellipse parameters in the "fixed" array, as these are used to define the center of the prior; the "nonlinear" parameters are the free-to-vary ellipse parameters minus the corresponding initial values.

Definition at line 174 of file GeneralPsfFitter.h.

174 { return _model; }

◆ getPrior()

std::shared_ptr<Prior> lsst::meas::modelfit::GeneralPsfFitter::getPrior ( ) const
inline

Return the Prior object that corresponds to the configuration.

This Prior class only supports evaluate() and evaluateDerivatives(), reflecting the fact that we only intend to use it with a Optimizer, not a Sampler.

Definition at line 182 of file GeneralPsfFitter.h.

182 { return _prior; }

The documentation for this class was generated from the following file: