LSST Applications g00d0e8bbd7+8c5ae1fdc5,g013ef56533+603670b062,g083dd6704c+2e189452a7,g199a45376c+0ba108daf9,g1c5cce2383+bc9f6103a4,g1fd858c14a+cd69ed4fc1,g210f2d0738+c4742f2e9e,g262e1987ae+612fa42d85,g29ae962dfc+83d129e820,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+5eaa884f2a,g47891489e3+e32160a944,g53246c7159+8c5ae1fdc5,g5b326b94bb+dcc56af22d,g64539dfbff+c4742f2e9e,g67b6fd64d1+e32160a944,g74acd417e5+c122e1277d,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g88cb488625+47d24e4084,g89139ef638+e32160a944,g8d7436a09f+d14b4ff40a,g8ea07a8fe4+b212507b11,g90f42f885a+e1755607f3,g97be763408+34be90ab8c,g98df359435+ec1fa61bf1,ga2180abaac+8c5ae1fdc5,ga9e74d7ce9+43ac651df0,gbf99507273+8c5ae1fdc5,gc2a301910b+c4742f2e9e,gca7fc764a6+e32160a944,gd7ef33dd92+e32160a944,gdab6d2f7ff+c122e1277d,gdb1e2cdc75+1b18322db8,ge410e46f29+e32160a944,ge41e95a9f2+c4742f2e9e,geaed405ab2+0d91c11c6d,w.2025.44
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: