lsst.meas.extensions.simpleShape  22.0.0+17b55e6bd4
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
lsst::meas::extensions::simpleShape::SimpleShape Class Reference

#include <simpleShape.h>

Inheritance diagram for lsst::meas::extensions::simpleShape::SimpleShape:
lsst::meas::base::SimpleAlgorithm lsst::meas::base::SingleFrameAlgorithm lsst::meas::base::ForcedAlgorithm lsst::meas::base::BaseAlgorithm lsst::meas::base::BaseAlgorithm

Public Types

typedef SimpleShapeControl Control
 

Public Member Functions

 SimpleShape (Control const &ctrl, std::string const &name, afw::table::Schema &schema)
 
virtual void measure (afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
 
virtual void fail (afw::table::SourceRecord &measRecord, lsst::meas::base::MeasurementError *error=NULL) const
 
virtual void measureForced (afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::geom::SkyWcs const &refWcs) const
 
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
 
virtual void measureN (afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure) const
 
std::string getLogName () const
 

Static Public Member Functions

static base::FlagDefinitionList const & getFlagDefinitions ()
 
template<typename T >
static SimpleShapeResult computeMoments (afw::geom::ellipses::Ellipse const &weight, afw::image::MaskedImage< T > const &image, double nSigmaRegion=3.0)
 Compute the Gaussian-weighted moments of an image. More...
 
static Eigen::Matrix< double, 5, 6 > convertRawMoments (Eigen::Matrix< double, 6, 1 > const &q, afw::geom::ellipses::Quadrupole &quadrupole, geom::Point2D &center)
 Convert linear raw moments into an ellipse and centroid, and return the derivative of the conversion. More...
 
static Eigen::Matrix< double, 5, 5 > correctWeightedMoments (afw::geom::ellipses::Quadrupole const &weight, afw::geom::ellipses::Quadrupole &ellipse, geom::Point2D &center)
 Correct moments measured with a Gaussian weight function by assuming the data was also an elliptical Gaussian, and return the derivative of the correction. More...
 

Static Public Attributes

static unsigned int const N_FLAGS = 1
 
static base::FlagDefinition const FAILURE = flagDefinitions.addFailureFlag()
 

Protected Attributes

std::string _logName
 

Detailed Description

Definition at line 95 of file simpleShape.h.

Member Typedef Documentation

◆ Control

Definition at line 103 of file simpleShape.h.

Constructor & Destructor Documentation

◆ SimpleShape()

lsst::meas::extensions::simpleShape::SimpleShape::SimpleShape ( Control const &  ctrl,
std::string const &  name,
afw::table::Schema schema 
)

Definition at line 378 of file simpleShape.cc.

Member Function Documentation

◆ computeMoments()

template<typename T >
template SimpleShapeResult lsst::meas::extensions::simpleShape::SimpleShape::computeMoments ( afw::geom::ellipses::Ellipse const &  weight,
afw::image::MaskedImage< T > const &  image,
double  nSigmaRegion = 3.0 
)
static

Compute the Gaussian-weighted moments of an image.

Parameters
[in]weightAn ellipse object of Gaussian weights to apply to the measurement.
[in]imageA Masked image instance with int float or double pixels.
[in]nSigmaRegionMaximum radius for pixels to include, in units of sigma

Definition at line 161 of file simpleShape.cc.

◆ convertRawMoments()

MatrixMQ lsst::meas::extensions::simpleShape::SimpleShape::convertRawMoments ( Eigen::Matrix< double, 6, 1 > const &  q,
afw::geom::ellipses::Quadrupole quadrupole,
geom::Point2D center 
)
static

Convert linear raw moments into an ellipse and centroid, and return the derivative of the conversion.

Note
This function is mainly intended for internal use, and is only exposed publically so it can be unit-tested in Python.

For weight function \(w\) and data \(p\), the "raw" moments \(Q\) are defined as:

\begin{eqnarray*} Q_0 &=& \sum_n w(x_n, y_n) p_n \\ Q_{xx} &=& \sum_n w(x_n, y_n) x_n^2 p_n \\ Q_{yy} &=& \sum_n w(x_n, y_n) y_n^2 p_n \\ Q_{xy} &=& \sum_n w(x_n, y_n) x_n y_n p_n \\ Q_x &=& \sum_n w(x_n, y_n) x_n p_n \\ Q_y &=& \sum_n w(x_n, y_n) y_n p_n \end{eqnarray*}

whereas the converted ellipse and centroid moments are:

\begin{eqnarray*} M_{xx} &=& Q_{xx} / Q_0 - Q_x^2 \\ M_{xx} &=& Q_{yy} / Q_0 - Q_y^2 \\ M_{xx} &=& Q_{xy} / Q_0 - Q_x Q_y \\ M_x &=& Q_x / Q_0 \\ M_y &=& Q_y / Q_0 \end{eqnarray*}

Note the slightly unusual ordering; this is for consistency with afw::geom::ellipses::Ellipse.

Definition at line 203 of file simpleShape.cc.

◆ correctWeightedMoments()

MatrixM lsst::meas::extensions::simpleShape::SimpleShape::correctWeightedMoments ( afw::geom::ellipses::Quadrupole const &  weight,
afw::geom::ellipses::Quadrupole ellipse,
geom::Point2D center 
)
static

Correct moments measured with a Gaussian weight function by assuming the data was also an elliptical Gaussian, and return the derivative of the correction.

Note
This function is mainly intended for internal use, and is only exposed publically so it can be unit-tested in Python.

If we naively measure Gaussian-weighted moments, we'll measure the moments of the product of the weight function and the data. What we want is the moments of the data, as if we had measured them with no weight function (but without sacrificing the S/N benefit that comes from using a weight function). To do that, we assume the data is also an elliptical Gaussian, and "divide" the weight function from the measured moments to compute it.

If \(W\) and \(M\) are the quadruple matrices of the weight function and measurement, and \(\eta\) is the measured centroid (we work in a coordinate system where the weight function is centered at the origin), then the corrected quadrupole matrix \(C\) and centroid are \(\nu\) are:

\begin{eqnarray*} C &=& \left(M^{-1} - W^{-1}\right)^{-1} \\ \nu &=& C M^{-1} \eta \end{eqnarray*}

Definition at line 234 of file simpleShape.cc.

◆ fail()

void lsst::meas::extensions::simpleShape::SimpleShape::fail ( afw::table::SourceRecord measRecord,
lsst::meas::base::MeasurementError error = NULL 
) const
virtual

Implements lsst::meas::base::SimpleAlgorithm.

Definition at line 399 of file simpleShape.cc.

◆ getFlagDefinitions()

base::FlagDefinitionList const & lsst::meas::extensions::simpleShape::SimpleShape::getFlagDefinitions ( )
static

Definition at line 37 of file simpleShape.cc.

◆ measure()

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

Implements lsst::meas::base::SimpleAlgorithm.

Definition at line 388 of file simpleShape.cc.

Member Data Documentation

◆ FAILURE

base::FlagDefinition const lsst::meas::extensions::simpleShape::SimpleShape::FAILURE = flagDefinitions.addFailureFlag()
static

Definition at line 101 of file simpleShape.h.

◆ N_FLAGS

unsigned int const lsst::meas::extensions::simpleShape::SimpleShape::N_FLAGS = 1
static

Definition at line 100 of file simpleShape.h.


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