LSST Applications g013ef56533+d2224463a4,g199a45376c+0ba108daf9,g19c4beb06c+9f335b2115,g1fd858c14a+2459ca3e43,g210f2d0738+2d3d333a78,g262e1987ae+abbb004f04,g2825c19fe3+eedc38578d,g29ae962dfc+0cb55f06ef,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+19c3a54948,g47891489e3+501a489530,g4cdb532a89+a047e97985,g511e8cfd20+ce1f47b6d6,g53246c7159+8c5ae1fdc5,g54cd7ddccb+890c8e1e5d,g5fd55ab2c7+951cc3f256,g64539dfbff+2d3d333a78,g67b6fd64d1+501a489530,g67fd3c3899+2d3d333a78,g74acd417e5+0ea5dee12c,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+501a489530,g8d7436a09f+5ea4c44d25,g8ea07a8fe4+81eaaadc04,g90f42f885a+34c0557caf,g9486f8a5af+165c016931,g97be763408+d5e351dcc8,gbf99507273+8c5ae1fdc5,gc2a301910b+2d3d333a78,gca7fc764a6+501a489530,gce8aa8abaa+8c5ae1fdc5,gd7ef33dd92+501a489530,gdab6d2f7ff+0ea5dee12c,ge410e46f29+501a489530,geaed405ab2+e3b4b2a692,gf9a733ac38+8c5ae1fdc5,w.2025.41
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: