LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
CentroidUtilities.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2014 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
25 #define LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
26 
29 
30 namespace lsst { namespace meas { namespace base {
31 
41 
44 
46  Centroid const getCentroid() const;
47 
49  void setCentroid(Centroid const & centroid);
50 
52  CentroidCov const getCentroidErr() const;
53 
55  void setCentroidErr(CentroidCov const & matrix);
56 
57 };
58 
65 class CentroidResultKey : public afw::table::FunctorKey<CentroidResult> {
66 public:
67 
81  std::string const & name,
82  std::string const & doc,
83  UncertaintyEnum uncertainty
84  );
85 
88 
93  ) :
94  _centroid(centroid), _centroidErr(centroidErr)
95  {}
96 
107 
109  virtual CentroidResult get(afw::table::BaseRecord const & record) const;
110 
112  virtual void set(afw::table::BaseRecord & record, CentroidResult const & value) const;
113 
115  bool operator==(CentroidResultKey const & other) const {
117  return _centroid == other._centroid && _centroidErr == other._centroidErr;
118  }
119  bool operator!=(CentroidResultKey const & other) const { return !(*this == other); }
121 
123  bool isValid() const { return _centroid.isValid() && _centroidErr.isValid(); }
124 
127 
130 
133 
136 
137 private:
140 };
141 
142 }}} // lsst::meas::base
143 
144 #endif // !LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:46
bool operator!=(CentroidResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
A proxy type for name lookups in a Schema.
Definition: Schema.h:370
ErrElement ySigma
1-Sigma uncertainty on y (sqrt of variance)
Key< T > getY() const
Return the underlying y Key.
Definition: aggregates.h:111
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
Definition: constants.h:41
afw::table::Key< CentroidElement > getY() const
Return a Key for the y coordinate.
A reusable struct for centroid measurements.
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
ErrElement xSigma
1-Sigma uncertainty on x (sqrt of variance)
CentroidElement x
x (column) coordinate of the measured position
bool isValid() const
Return True if the centroid key is valid.
void setCentroid(Centroid const &centroid)
Set the struct fields from the given Point object.
afw::table::CovarianceMatrixKey< ErrElement, 2 > getCentroidErr() const
Return a FunctorKey to just the uncertainty matrix.
CentroidResultKey(afw::table::PointKey< CentroidElement > const &centroid, afw::table::CovarianceMatrixKey< ErrElement, 2 > const &centroidErr)
Construct from a pair of Keys.
float ErrElement
Definition: constants.h:51
Key< T > getX() const
Return the underlying x Key.
Definition: aggregates.h:108
A coordinate class intended to represent absolute positions.
bool isValid() const
Return True if both the x and y Keys are valid.
Definition: aggregates.h:105
CentroidResult()
Constructor; initializes everything to NaN.
tbl::Schema schema
Definition: CoaddPsf.cc:324
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
afw::table::Key< CentroidElement > getX() const
Return a Key for the x coordinate.
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...
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
Base class for all records.
Definition: BaseRecord.h:27
afw::table::PointKey< CentroidElement > getCentroid() const
Return a FunctorKey to just the centroid value.
CentroidCov const getCentroidErr() const
Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)
A FunctorKey for CentroidResult.
CentroidElement y
y (row) coordinate of the measured position
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
Definition: constants.h:55
bool isValid() const
Return True if all the constituent sigma Keys are valid.
afw::table::PointKey< CentroidElement > _centroid
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
double CentroidElement
Definition: constants.h:52
afw::table::CovarianceMatrixKey< ErrElement, 2 > _centroidErr
bool operator==(CentroidResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
afw::table::SourceRecord * record
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...