LSST Applications g042eb84c57+730a74494b,g04e9c324dd+8c5ae1fdc5,g134cb467dc+1f1e3e7524,g199a45376c+0ba108daf9,g1fd858c14a+fa7d31856b,g210f2d0738+f66ac109ec,g262e1987ae+83a3acc0e5,g29ae962dfc+d856a2cb1f,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+a1e0c9f713,g47891489e3+0d594cb711,g4d44eb3520+c57ec8f3ed,g4d7b6aa1c5+f66ac109ec,g53246c7159+8c5ae1fdc5,g56a1a4eaf3+fd7ad03fde,g64539dfbff+f66ac109ec,g67b6fd64d1+0d594cb711,g67fd3c3899+f66ac109ec,g6985122a63+0d594cb711,g74acd417e5+3098891321,g786e29fd12+668abc6043,g81db2e9a8d+98e2ab9f28,g87389fa792+8856018cbb,g89139ef638+0d594cb711,g8d7436a09f+80fda9ce03,g8ea07a8fe4+760ca7c3fc,g90f42f885a+033b1d468d,g97be763408+a8a29bda4b,g99822b682c+e3ec3c61f9,g9d5c6a246b+0d5dac0c3d,ga41d0fce20+9243b26dd2,gbf99507273+8c5ae1fdc5,gd7ef33dd92+0d594cb711,gdab6d2f7ff+3098891321,ge410e46f29+0d594cb711,geaed405ab2+c4bbc419c6,gf9a733ac38+8c5ae1fdc5,w.2025.38
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: