27 namespace lsst {
namespace meas {
namespace base {
32 xSigma(std::numeric_limits<
ErrElement>::quiet_NaN()),
33 ySigma(std::numeric_limits<
ErrElement>::quiet_NaN()),
34 x_y_Cov(std::numeric_limits<
ErrElement>::quiet_NaN())
53 xSigma = std::sqrt(matrix(0, 0));
54 ySigma = std::sqrt(matrix(1, 1));
66 std::string
const &
name,
67 std::string
const & doc,
78 std::vector< afw::table::Key<ErrElement> >
sigma(2);
79 std::vector< afw::table::Key<ErrElement> > cov;
81 schema.
join(name,
"xSigma"),
"1-sigma uncertainty on x position",
"pixel"
84 schema.
join(name,
"ySigma"),
"1-sigma uncertainty on y position",
"pixel"
89 schema.
join(name,
"x_y_Cov"),
"uncertainty covariance in x and y",
"pixel^2"
100 std::vector<std::string> getNameVector() {
101 std::vector<std::string> v;
112 static std::vector<std::string> names = getNameVector();
115 }
catch (pex::exceptions::NotFoundError &) {}
135 std::string
const &
name,
141 mapper.addMapping(mapper.getInputSchema().find<afw::table::Flag>(
name +
"_flag").key);
144 auto & s = mapper.editOutputSchema();
151 std::vector< afw::table::Key<ErrElement> >
sigma(2);
152 std::vector< afw::table::Key<ErrElement> > cov(1);
156 "Uncertainty covariance in RA and dec",
"rad^2");
174 for (; inSrc != inputCatalog.
end() && outSrc != outputCatalog.
end(); ++inSrc, ++outSrc) {
179 if (centroidResultKey.getCentroidErr().isValid()) {
181 if (!(std::isnan(centroidCov(0,0)) || std::isnan(centroidCov(1,1)))) {
185 transform.transpose()).cast<ErrElement>());
195 std::string
const &
name,
196 bool doFootprintCheck,
197 double maxDistFromPeak
198 ) : _doFootprintCheck(doFootprintCheck), _maxDistFromPeak(maxDistFromPeak)
201 "set if CentroidChecker reset the centroid");
221 pex::exceptions::RuntimeError,
222 "No Footprint attached to record");
227 double distsq = (x - footX) * (x - footX) + (y - footY) * (y - footY);
Defines the fields and offsets for a table.
afw::table::Key< CentroidElement > _yKey
CentroidElement y
y (row) coordinate of the measured position
A proxy type for name lookups in a Schema.
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
afw::table::CovarianceMatrixKey< ErrElement, 2 > _centroidErr
table::Key< std::string > name
geom::AffineTransform linearizePixelToSky(coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
Return the local linear approximation to Wcs::pixelToSky at a point given in sky coordinates.
ErrElement ySigma
1-Sigma uncertainty on y (sqrt of variance)
afw::table::Key< afw::table::Flag > _resetKey
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
A custom container class for records, based on std::vector.
afw::table::Schema schema
A mapping between the keys of two Schemas, used to copy data between them.
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
A reusable struct for centroid measurements.
virtual CentroidResult get(afw::table::BaseRecord const &record) const
Get a CentroidResult from the given record.
afw::table::PointKey< CentroidElement > _centroid
boost::shared_ptr< Footprint > getFootprint() const
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
CentroidChecker(afw::table::Schema &schema, std::string const &name, bool inside=true, double maxDistFromPeak=-1.0)
Implementation of the WCS standard for a any projection.
boost::shared_ptr< coord::Coord > pixelToSky(double pix1, double pix2) const
Convert from pixel position to sky coordinates (e.g. RA/dec)
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
Algorithm provides no uncertainy information at all.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
A coordinate class intended to represent absolute positions.
afw::table::Key< double > sigma
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
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...
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
The full covariance matrix is provided.
AngleUnit const radians
constant with units of radians
Iterator class for CatalogT.
virtual void set(BaseRecord &record, coord::IcrsCoord const &value) const
Set an IcrsCoord in the given record.
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...
ErrElement xSigma
1-Sigma uncertainty on x (sqrt of variance)
bool operator()(afw::table::SourceRecord &record) const
CentroidResult()
Constructor; initializes everything to NaN.
#define LSST_EXCEPT(type,...)
Base class for all records.
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
afw::geom::Point< CentroidElement, 2 > Centroid
virtual void set(BaseRecord &record, Eigen::Matrix< T, N, N > const &value) const
Set a covariance matrix in the given record (uses only the lower triangle of the given matrix) ...
CentroidElement x
x (column) coordinate of the measured position
A FunctorKey for CentroidResult.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
bool isValid() const
Return True if all the constituent sigma Keys are valid.
Record class that contains measurements made on a single exposure.
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
afw::table::Key< CentroidElement > _xKey
CentroidCov const getCentroidErr() const
Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)
afw::table::Key< afw::table::Flag > _failureKey
Schema getSchema() const
Return the schema associated with the catalog's table.
bool isValid() const
Return True if the centroid key is valid.