LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst::meas::base::CentroidResultKey Class Referenceabstract

A FunctorKey for CentroidResult. More...

#include <CentroidUtilities.h>

Inheritance diagram for lsst::meas::base::CentroidResultKey:
lsst::afw::table::FunctorKey< CentroidResult > lsst::afw::table::OutputFunctorKey< CentroidResult > lsst::afw::table::InputFunctorKey< CentroidResult >

Public Types

using Value
 The data type for get and set.
 

Public Member 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.
 
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 operator== (CentroidResultKey const &other) const
 Compare the FunctorKey for equality with another, using the underlying Keys.
 
bool operator!= (CentroidResultKey const &other) const
 
bool isValid () const
 Return True if the centroid key is valid.
 
afw::table::PointKey< CentroidElementgetCentroid () 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< CentroidElementgetX () const
 Return a Key for the x coordinate.
 
afw::table::Key< CentroidElementgetY () const
 Return a Key for the y coordinate.
 
virtual void set (BaseRecord &record, CentroidResult const &value) const=0
 
virtual void set (BaseRecord &record, CentroidResult const &value) const=0
 

Static Public Member 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.
 

Detailed Description

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.

Definition at line 90 of file CentroidUtilities.h.

Member Typedef Documentation

◆ Value

using lsst::afw::table::FunctorKey< CentroidResult >::Value
inherited

The data type for get and set.

Definition at line 77 of file FunctorKey.h.

Constructor & Destructor Documentation

◆ CentroidResultKey() [1/3]

lsst::meas::base::CentroidResultKey::CentroidResultKey ( )
inline

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

Definition at line 107 of file CentroidUtilities.h.

107: _centroid(), _centroidErr() {}

◆ CentroidResultKey() [2/3]

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

Construct from a pair of Keys.

Definition at line 110 of file CentroidUtilities.h.

112 : _centroid(centroid), _centroidErr(centroidErr) {}

◆ CentroidResultKey() [3/3]

lsst::meas::base::CentroidResultKey::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"]);
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.

Definition at line 102 of file CentroidUtilities.cc.

102 : _centroid(s) {
103 static std::vector<std::string> names = getNameVector(); // C++11 TODO: just use initializer list
104 try {
105 _centroidErr = afw::table::CovarianceMatrixKey<ErrElement, 2>(s, names);
106 } catch (pex::exceptions::NotFoundError &) {
107 }
108}

Member Function Documentation

◆ addFields()

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

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

Parameters
[in,out]schemaSchema to add fields to.
[in]nameName prefix for all fields; "_x", "_y", etc. will be appended to this to form the full field names.
[in]docString used as the documentation for the x and y fields.
[in]uncertaintyEnum indicating which (if any) uncertainty values will be saved.

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

Definition at line 71 of file CentroidUtilities.cc.

72 {
74 r._centroid = afw::table::PointKey<CentroidElement>::addFields(schema, name, doc, "pixel");
75 if (uncertainty != NO_UNCERTAINTY) {
76 std::vector<afw::table::Key<ErrElement> > sigma(2);
77 std::vector<afw::table::Key<ErrElement> > cov;
78 sigma[0] = schema.addField<ErrElement>(schema.join(name, "xErr"), "1-sigma uncertainty on x position",
79 "pixel");
80 sigma[1] = schema.addField<ErrElement>(schema.join(name, "yErr"), "1-sigma uncertainty on y position",
81 "pixel");
82 if (uncertainty == FULL_COVARIANCE) {
83 cov.push_back(schema.addField<ErrElement>(schema.join(name, "x_y_Cov"),
84 "uncertainty covariance in x and y", "pixel^2"));
85 }
86 r._centroidErr = afw::table::CovarianceMatrixKey<ErrElement, 2>(sigma, cov);
87 }
88 return r;
89}
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
Add a pair of _x, _y fields to a Schema, and return a PointKey that points to them.
Definition aggregates.cc:36
@ FULL_COVARIANCE
The full covariance matrix is provided.
Definition constants.h:46
@ NO_UNCERTAINTY
Algorithm provides no uncertainy information at all.
Definition constants.h:44
T push_back(T... args)

◆ get()

CentroidResult lsst::meas::base::CentroidResultKey::get ( afw::table::BaseRecord const & record) const
virtual

Get a CentroidResult from the given record.

Implements lsst::afw::table::OutputFunctorKey< CentroidResult >.

Definition at line 110 of file CentroidUtilities.cc.

110 {
111 CentroidResult r;
112 r.setCentroid(record.get(_centroid));
113 if (_centroidErr.isValid()) {
114 r.setCentroidErr(record.get(_centroidErr));
115 }
116 return r;
117}

◆ getCentroid()

afw::table::PointKey< CentroidElement > lsst::meas::base::CentroidResultKey::getCentroid ( ) const
inline

Return a FunctorKey to just the centroid value.

Definition at line 143 of file CentroidUtilities.h.

143{ return _centroid; }

◆ getCentroidErr()

afw::table::CovarianceMatrixKey< ErrElement, 2 > lsst::meas::base::CentroidResultKey::getCentroidErr ( ) const
inline

Return a FunctorKey to just the uncertainty matrix.

Definition at line 146 of file CentroidUtilities.h.

146{ return _centroidErr; }

◆ getX()

afw::table::Key< CentroidElement > lsst::meas::base::CentroidResultKey::getX ( ) const
inline

Return a Key for the x coordinate.

Definition at line 149 of file CentroidUtilities.h.

149{ return _centroid.getX(); }

◆ getY()

afw::table::Key< CentroidElement > lsst::meas::base::CentroidResultKey::getY ( ) const
inline

Return a Key for the y coordinate.

Definition at line 152 of file CentroidUtilities.h.

152{ return _centroid.getY(); }

◆ isValid()

bool lsst::meas::base::CentroidResultKey::isValid ( ) const
inline

Return True if the centroid key is valid.

Definition at line 140 of file CentroidUtilities.h.

140{ return _centroid.isValid() && _centroidErr.isValid(); }

◆ operator!=()

bool lsst::meas::base::CentroidResultKey::operator!= ( CentroidResultKey const & other) const
inline

Definition at line 136 of file CentroidUtilities.h.

136{ return !(*this == other); }

◆ operator==()

bool lsst::meas::base::CentroidResultKey::operator== ( CentroidResultKey const & other) const
inline

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

Definition at line 133 of file CentroidUtilities.h.

133 {
134 return _centroid == other._centroid && _centroidErr == other._centroidErr;
135 }

◆ set() [1/3]

virtual void lsst::afw::table::InputFunctorKey< CentroidResult >::set ( BaseRecord & record,
CentroidResult const & value ) const
pure virtualinherited

◆ set() [2/3]

virtual void lsst::afw::table::InputFunctorKey< CentroidResult >::set ( BaseRecord & record,
CentroidResult const & value ) const
pure virtualinherited

◆ set() [3/3]

void lsst::meas::base::CentroidResultKey::set ( afw::table::BaseRecord & record,
CentroidResult const & value ) const
virtual

Set a CentroidResult in the given record.

Definition at line 119 of file CentroidUtilities.cc.

119 {
120 record.set(_centroid, value.getCentroid());
121 if (_centroidErr.isValid()) {
122 record.set(_centroidErr, value.getCentroidErr());
123 }
124}

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