File CentroidUtilities.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace meas
namespace base
class CentroidChecker

Public Functions

CentroidChecker(afw::table::Schema &schema, std::string const &name, bool inside = true, double maxDistFromPeak = -1.0)

Check source record produced by a centroid algorithm called “name”.

If the centroid is accompanied by uncertainties (the xErr and yErr fields), these should not be NaN. If they are, the algorithmName + “_flag_badError” flag and the general failure flag for the algorithm are both set.

If the centroid set by the algorithm lies outside the footprint attached to the record, or the centroid is more than “dist” pixels from the footprint peak:

(1) the general failure flag for the algorithm is set (2) algorithmName + “_flag_resetToPeak” flag is set (3) the position of the centroid is changed to that of the footprint Peak

Parameters
  • [inout] schema: Schema to which the flag_resetToPeak is to be added

  • [in] name: The name of the algorithm we will be checking

  • [in] doFootprintCheck: Check if centroid is within footprint

  • [in] maxDistFromPeak: Check if centroid is more than dist from footprint peak

bool operator()(afw::table::SourceRecord &record) const

Set the centroid to the first footprint if the centroid is either more than _dist pixels from the footprint center, or if it is outside the footprint. Set appropriate flags to indicate any changes to the centroid, and to indicate if uncertainties are set to invalid (“NaN”) values.

Private Members

bool _doFootprintCheck
double _maxDistFromPeak
afw::table::Key<afw::table::Flag> _resetKey
afw::table::Key<afw::table::Flag> _failureKey
afw::table::Key<afw::table::Flag> _badErrorKey
afw::table::Key<CentroidElement> _xKey
afw::table::Key<CentroidElement> _yKey
afw::table::Key<ErrElement> _xErrKey
afw::table::Key<ErrElement> _yErrKey
struct CentroidResult
#include <CentroidUtilities.h>

A reusable struct for centroid measurements.

Subclassed by lsst::meas::base::SdssShapeResult

Public Functions

CentroidResult()

Constructor; initializes everything to NaN.

CentroidResult(CentroidElement x_, CentroidElement y_, CentroidCov const &matrix)

Constructor; initializes everything from values.

CentroidResult(CentroidElement x_, CentroidElement y_, ErrElement xErr_, ErrElement yErr_)

Constructor; initializes everything from values.

Centroid const getCentroid() const

Return a Point object containing the measured x and y.

void setCentroid(Centroid const &centroid)

Set the struct fields from the given Point object.

geom::Point<CentroidElement> getPoint()

Return the 2D point type corresponding to this result.

CentroidCov const getCentroidErr() const

Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)

void setCentroidErr(CentroidCov const &matrix)

Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x, y)

void setCentroidErr(ErrElement _xErr, ErrElement _yErr)

Set the struct uncertainty fields from the sigma values.

Public Members

CentroidElement x

x (column) coordinate of the measured position

CentroidElement y

y (row) coordinate of the measured position

ErrElement xErr

standard deviation of x

ErrElement yErr

standard deviation of y

ErrElement x_y_Cov

x,y term in the uncertainty convariance matrix

class CentroidResultKey : public lsst::afw::table::FunctorKey<CentroidResult>
#include <CentroidUtilities.h>

A FunctorKey for CentroidResult.

This class makes it easy to copy centroids and their uncertainties to and from records, and provides a method to add the appropriate fields to a Schema.

Unnamed Group

bool operator==(CentroidResultKey const &other) const

Compare the FunctorKey for equality with another, using the underlying Keys.

bool operator!=(CentroidResultKey const &other) const

Public Functions

CentroidResultKey()

Default constructor; instance will not be usuable unless subsequently assigned to.

CentroidResultKey(afw::table::PointKey<CentroidElement> const &centroid, afw::table::CovarianceMatrixKey<ErrElement, 2> const &centroidErr)

Construct from a pair of Keys.

CentroidResultKey(afw::table::SubSchema const &s)

Construct from a subschema, assuming _x, _y, etc. subfields.

If a schema has “a_x”, “a_y”, etc. fields, this constructor allows you to construct a CentroidResultKey via:

CentroidResultKey k(schema["a"]);

virtual CentroidResult get(afw::table::BaseRecord const &record) const

Get a CentroidResult from the given record.

virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const

Set a CentroidResult in the given record.

bool isValid() const

Return True if the centroid key is valid.

afw::table::PointKey<CentroidElement> getCentroid() const

Return a FunctorKey to just the centroid value.

afw::table::CovarianceMatrixKey<ErrElement, 2> getCentroidErr() const

Return a FunctorKey to just the uncertainty matrix.

afw::table::Key<CentroidElement> getX() const

Return a Key for the x coordinate.

afw::table::Key<CentroidElement> getY() const

Return a Key for the y coordinate.

Public Static Functions

static CentroidResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc, UncertaintyEnum uncertainty)

Add the appropriate fields to a Schema, and return a CentroidResultKey that manages them.

The unit for all fields will be pixels (pixels^2 for covariances).

Parameters
  • [inout] schema: Schema to add fields to.

  • [in] name: Name prefix for all fields; “_x”, “_y”, etc. will be appended to this to form the full field names.

  • [in] doc: String used as the documentation for the x and y fields.

  • [in] uncertainty: Enum indicating which (if any) uncertainty values will be saved.

Private Members

afw::table::PointKey<CentroidElement> _centroid
afw::table::CovarianceMatrixKey<ErrElement, 2> _centroidErr
class CentroidTransform : public lsst::meas::base::BaseTransform
#include <CentroidUtilities.h>

Base for centroid measurement transformations.

Provides a basic transform from centroid plus associated uncertainty to celestial position with uncertainty. The basic “flag” attribute for the measurement algorithm is propagated to the output.

Subclasses should define a constructor which take a Control argument corresponding to the measurement algorithm being transformed and ensure that any other necessary flags are propagated.

Subclassed by lsst::meas::base::NaiveCentroidTransform, lsst::meas::base::SdssCentroidTransform

Public Functions

CentroidTransform(std::string const &name, afw::table::SchemaMapper &mapper)
virtual void operator()(afw::table::SourceCatalog const &inputCatalog, afw::table::BaseCatalog &outputCatalog, afw::geom::SkyWcs const &wcs, afw::image::PhotoCalib const &photoCalib) const

Private Members

afw::table::CoordKey _coordKey
afw::table::CovarianceMatrixKey<ErrElement, 2> _coordErrKey