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 Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm Class Reference

An algorithm that fits a 2-component shapelet approximation to the PSF model. More...

#include <DoubleShapeletPsfApprox.h>

Inheritance diagram for lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm:
lsst::meas::base::SimpleAlgorithm lsst::meas::base::SingleFrameAlgorithm lsst::meas::base::ForcedAlgorithm lsst::meas::base::BaseAlgorithm lsst::meas::base::BaseAlgorithm

Public Types

typedef DoubleShapeletPsfApproxControl Control
 

Public Member Functions

 DoubleShapeletPsfApproxAlgorithm (Control const &ctrl, std::string const &name, afw::table::Schema &schema)
 Failure modes passed by MeasurementErrors thrown by this class. More...
 
void measure (afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
 Run all fitting stages on the Psf attached to the given Exposure, saving the results in measRecord. More...
 
void fail (afw::table::SourceRecord &measRecord, lsst::meas::base::MeasurementError *error=nullptr) const
 Handle failures caught by the measurement plugin system, setting failure flags as appropriate. More...
 
virtual void measureForced (afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::geom::SkyWcs const &refWcs) const
 Called to measure a single child source in an image. More...
 
virtual void measureNForced (afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure, afw::table::SourceCatalog const &refRecord, afw::geom::SkyWcs const &refWcs) const
 Called to simultaneously measure all children in a deblend family, in a single image. More...
 
virtual void measureN (afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure) const
 Called to simultaneously measure all children in a deblend family, in a single image. More...
 
std::string getLogName () const
 

Static Public Member Functions

static base::FlagDefinitionList const & getFlagDefinitions ()
 
static shapelet::MultiShapeletFunction initializeResult (Control const &ctrl)
 Create a MultiShapeletFunction with orders and radii and amplitude ratios from the control object. More...
 
static void fitMoments (shapelet::MultiShapeletFunction &result, Control const &ctrl, afw::image::Image< Scalar > const &psfImage)
 Update a MultiShapeletFunction's ellipses to match the first and second moments of a PSF image. More...
 
static std::shared_ptr< OptimizerObjectivemakeObjective (afw::geom::ellipses::Ellipse const &moments, Control const &ctrl, afw::image::Image< Scalar > const &psfImage)
 Return an Objective object that can be used to fit the profile of the model. More...
 
static void fitProfile (shapelet::MultiShapeletFunction &result, Control const &ctrl, afw::image::Image< Scalar > const &psfImage)
 Update a MultiShapeletFunction's zeroth-order profile by fitting radii and amplitudes. More...
 
static void fitShapelets (shapelet::MultiShapeletFunction &result, Control const &ctrl, afw::image::Image< Scalar > const &psfImage)
 Update a MultiShapeletFunction's higher-order shapelet terms, holding everything else fixed. More...
 

Static Public Attributes

static base::FlagDefinition const FAILURE
 
static base::FlagDefinition const INVALID_POINT_FOR_PSF
 
static base::FlagDefinition const INVALID_MOMENTS
 
static base::FlagDefinition const MAX_ITERATIONS
 

Protected Attributes

std::string _logName
 

Detailed Description

An algorithm that fits a 2-component shapelet approximation to the PSF model.

This algorithm fits a similar model to the one that has been used on the HSC side for several data releases, but uses the improved optimizer in meas_modelfit instead of the one in (the now defunct) meas_extensions_multiShapelet and using moments to reduce the number of parameters in the fit. It is faster and more robust than GeneralShapeletPsfApprox, but much less flexible.

The model is not a fully general one, even for two shapelet components. We tie the ellipticities of the two components together, hold the center fixed, and keep their radii fixed at a value set in the configuration; this means we fit only one set of ellipse parameters, instead of two.

Definition at line 96 of file DoubleShapeletPsfApprox.h.

Member Typedef Documentation

◆ Control

Definition at line 106 of file DoubleShapeletPsfApprox.h.

Constructor & Destructor Documentation

◆ DoubleShapeletPsfApproxAlgorithm()

lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::DoubleShapeletPsfApproxAlgorithm ( Control const &  ctrl,
std::string const &  name,
afw::table::Schema schema 
)

Failure modes passed by MeasurementErrors thrown by this class.

Construct an algorithm for use with record outputs.

Essentially all of the functionality of this class is accessible through static methods, so an instance only needs to be constructed if you want to store the results in a record object.

Parameters
[in]ctrlControl object specifying the details of the model and how to fit it.
[in]nameName of the algorithm; will be used as the prefix for all field names.
[in,out]schemaSchema to which fields will be added. Must already contain a slot_Centroid alias pointing to fields with position information.

Member Function Documentation

◆ fail()

void lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::fail ( afw::table::SourceRecord measRecord,
lsst::meas::base::MeasurementError error = nullptr 
) const
virtual

Handle failures caught by the measurement plugin system, setting failure flags as appropriate.

Implements lsst::meas::base::BaseAlgorithm.

◆ fitMoments()

static void lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::fitMoments ( shapelet::MultiShapeletFunction result,
Control const &  ctrl,
afw::image::Image< Scalar > const &  psfImage 
)
static

Update a MultiShapeletFunction's ellipses to match the first and second moments of a PSF image.

The relative ampltidues, radii, and ellipticities of the ellipses will not be modified; both ellipses will simply be transformed (together) such that the moments of the MultiShapeletFunction match the (unweighted) moments of the image, and the two components will be scaled together to match the total flux in the image.

Parameters
[in,out]resultMultiShapeletFunction to update. Must have unit circle moments. Probably the result of a call to initializeResult().
[in]ctrlControl object specifying the details of the model and how to fit it.
[in]psfImageImage of the PSF to fit. Should have xy0 set such that (0,0) is at the center of the image. Probably the result of a call to Psf::computeKernelImage().
Exceptions
meas::base::MeasurementErrorif the resulting moments are invalid, either because they have negative determinant or the radii are out of bounds.

◆ fitProfile()

static void lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::fitProfile ( shapelet::MultiShapeletFunction result,
Control const &  ctrl,
afw::image::Image< Scalar > const &  psfImage 
)
static

Update a MultiShapeletFunction's zeroth-order profile by fitting radii and amplitudes.

Holding the center positions and ellipticities fixed, the radii and amplitudes of the two Gaussians are fit simultaneously with an optimizer. Higher-order terms will be ignored.

Parameters
[in,out]resultMultiShapeletFunction to update. Probably the result of a call to fitMoments().
[in]ctrlControl object specifying the details of the model and how to fit it.
[in]psfImageImage of the PSF to fit. Should have xy0 set such that (0,0) is at the center of the image. Probably the result of a call to Psf::computeKernelImage().

◆ fitShapelets()

static void lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::fitShapelets ( shapelet::MultiShapeletFunction result,
Control const &  ctrl,
afw::image::Image< Scalar > const &  psfImage 
)
static

Update a MultiShapeletFunction's higher-order shapelet terms, holding everything else fixed.

All ellipse parameters and the zeroth-order (Gaussian) shapelet coefficients will be held fixed.

Parameters
[in,out]resultMultiShapeletFunction to update. Probably the result of a call to fitProfile().
[in]ctrlControl object specifying the details of the model and how to fit it.
[in]psfImageImage of the PSF to fit. Should have xy0 set such that (0,0) is at the center of the image. Probably the result of a call to Psf::computeKernelImage().

◆ getFlagDefinitions()

static base::FlagDefinitionList const& lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::getFlagDefinitions ( )
static

◆ getLogName()

std::string lsst::meas::base::BaseAlgorithm::getLogName ( ) const
inlineinherited

Definition at line 66 of file Algorithm.h.

66 { return _logName; }

◆ initializeResult()

static shapelet::MultiShapeletFunction lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::initializeResult ( Control const &  ctrl)
static

Create a MultiShapeletFunction with orders and radii and amplitude ratios from the control object.

This creates a circular two-component MultiShapeletFunction with unit total flux and unit circle moments, with zeroth-order amplitudes matching ctrl.peakRatio and ellipse radii matching ctrl.radiusRatio.

◆ makeObjective()

static std::shared_ptr<OptimizerObjective> lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::makeObjective ( afw::geom::ellipses::Ellipse const &  moments,
Control const &  ctrl,
afw::image::Image< Scalar > const &  psfImage 
)
static

Return an Objective object that can be used to fit the profile of the model.

By "profile" we mean the two radii and two zeroth-order amplitudes, which we fit in fitProfile() while holding all other parameters fixed.

This function is probably not useful to most users, who should just call fitProfile instead; it's public mostly to make it easier to test functionality internal to fitProfile().

The parameters expected by the Objective are:

  • The zeroth-order amplitude of the inner component.
  • The zeroth-order amplitude of the outer component.
  • The determinant radius of the inner component relative to the determinant radius of the moments ellipse.
  • The determinant radius of the outer component relative to the determinant radius of the moments ellipse.
Parameters
[in]momentsEllipse computed from the moments of the MultiShapeletFunction to be fit.
[in]ctrlControl object specifying the details of the model and how to fit it.
[in]psfImageImage of the PSF to fit. Should have xy0 set such that (0,0) is at the center of the image. Probably the result of a call to Psf::computeKernelImage().

◆ measure()

void lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::measure ( afw::table::SourceRecord measRecord,
afw::image::Exposure< float > const &  exposure 
) const
virtual

Run all fitting stages on the Psf attached to the given Exposure, saving the results in measRecord.

We first call fitMoments(), then fitProfile(), then fitShapelets().

Implements lsst::meas::base::SingleFrameAlgorithm.

◆ measureForced()

virtual void lsst::meas::base::SimpleAlgorithm::measureForced ( afw::table::SourceRecord measRecord,
afw::image::Exposure< float > const &  exposure,
afw::table::SourceRecord const &  refRecord,
afw::geom::SkyWcs const &  refWcs 
) const
inlinevirtualinherited

Called to measure a single child source in an image.

Before this method is called, all neighbors will be replaced with noise, using the outputs of the deblender. Outputs should be saved in the given SourceRecord, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.

Implements lsst::meas::base::ForcedAlgorithm.

Reimplemented in lsst::meas::extensions::photometryKron::KronFluxAlgorithm.

Definition at line 172 of file Algorithm.h.

175  {
176  measure(measRecord, exposure);
177  }
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const =0
Called to measure a single child source in an image.

◆ measureN()

void lsst::meas::base::SingleFrameAlgorithm::measureN ( afw::table::SourceCatalog const &  measCat,
afw::image::Exposure< float > const &  exposure 
) const
virtualinherited

Called to simultaneously measure all children in a deblend family, in a single image.

Outputs should be saved in the given SourceCatalog, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.

The default implementation simply throws an exception, indicating that simultaneous measurement is not supported.

Definition at line 31 of file Algorithm.cc.

32  {
33  throw LSST_EXCEPT(pex::exceptions::LogicError, "measureN not implemented for this algorithm");
34 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ measureNForced()

virtual void lsst::meas::base::SimpleAlgorithm::measureNForced ( afw::table::SourceCatalog const &  measCat,
afw::image::Exposure< float > const &  exposure,
afw::table::SourceCatalog const &  refRecord,
afw::geom::SkyWcs const &  refWcs 
) const
inlinevirtualinherited

Called to simultaneously measure all children in a deblend family, in a single image.

Outputs should be saved in the given SourceCatalog, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.

The default implementation simply throws an exception, indicating that simultaneous measurement is not supported.

Reimplemented from lsst::meas::base::ForcedAlgorithm.

Definition at line 179 of file Algorithm.h.

182  {
183  measureN(measCat, exposure);
184  }
virtual void measureN(afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure) const
Called to simultaneously measure all children in a deblend family, in a single image.
Definition: Algorithm.cc:31

Member Data Documentation

◆ _logName

std::string lsst::meas::base::BaseAlgorithm::_logName
protectedinherited

Definition at line 69 of file Algorithm.h.

◆ FAILURE

base::FlagDefinition const lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::FAILURE
static

Definition at line 101 of file DoubleShapeletPsfApprox.h.

◆ INVALID_MOMENTS

base::FlagDefinition const lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::INVALID_MOMENTS
static

Definition at line 103 of file DoubleShapeletPsfApprox.h.

◆ INVALID_POINT_FOR_PSF

base::FlagDefinition const lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::INVALID_POINT_FOR_PSF
static

Definition at line 102 of file DoubleShapeletPsfApprox.h.

◆ MAX_ITERATIONS

base::FlagDefinition const lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm::MAX_ITERATIONS
static

Definition at line 104 of file DoubleShapeletPsfApprox.h.


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