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");
224 if (footprint->getPeaks().empty()) {
226 pex::exceptions::RuntimeError,
227 "Footprint has no peaks; cannot verify centroid."
232 double distsq = (x - footX) * (x - footX) + (y - footY) * (y - footY);
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) ...
Defines the fields and offsets for a table.
A proxy type for name lookups in a Schema.
ErrElement ySigma
1-Sigma uncertainty on y (sqrt of variance)
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.
AngleUnit const radians
constant with units of radians
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.
A reusable struct for centroid measurements.
bool operator()(afw::table::SourceRecord &record) const
Set the centroid to the first footprint if the centroid is either more than _dist pixels from the foo...
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
ErrElement xSigma
1-Sigma uncertainty on x (sqrt of variance)
The full covariance matrix is provided.
CentroidElement x
x (column) coordinate of the measured position
afw::table::Key< CentroidElement > _yKey
Implementation of the WCS standard for a any projection.
bool isValid() const
Return True if the centroid key is valid.
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
boost::shared_ptr< coord::Coord > pixelToSky(double pix1, double pix2) const
Convert from pixel position to sky coordinates (e.g.
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
Add a pair of _ra, _dec fields to a Schema, and return a CoordKey that points to them.
CentroidChecker(afw::table::Schema &schema, std::string const &name, bool inside=true, double maxDistFromPeak=-1.0)
Check source record for an centroid algorithm called name, noting if the centroid already set by the ...
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Describe an exposure's calibration.
A coordinate class intended to represent absolute positions.
afw::table::Key< double > sigma
CentroidResult()
Constructor; initializes everything to NaN.
afw::table::Key< CentroidElement > _xKey
afw::table::Key< afw::table::Flag > _resetKey
iterator begin()
Iterator access.
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.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
virtual void set(BaseRecord &record, coord::IcrsCoord const &value) const
Set an IcrsCoord in the given record.
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
Iterator class for CatalogT.
virtual CentroidResult get(afw::table::BaseRecord const &record) const
Get a CentroidResult from the given record.
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...
Schema getSchema() const
Return the schema associated with the catalog's table.
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.
afw::table::Key< afw::table::Flag > _failureKey
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
Base class for all records.
Algorithm provides no uncertainy information at all.
iterator end()
Iterator access.
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
afw::geom::Point< CentroidElement, 2 > Centroid
afw::table::PointKey< CentroidElement > _centroid
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Record class that contains measurements made on a single exposure.
afw::table::CovarianceMatrixKey< ErrElement, 2 > _centroidErr
boost::shared_ptr< Footprint > getFootprint() const
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...