67 os <<
"x=" << result.
x <<
", y=" << result.
y <<
", xErr=" << result.
xErr <<
", yErr=" << result.
yErr;
84 "uncertainty covariance in x and y",
"pixel^2"));
113 if (_centroidErr.isValid()) {
121 if (_centroidErr.isValid()) {
145 s.join(name,
"raErr"),
146 "1-sigma uncertainty on the local tangent-plane longitude offset"
147 " xi = RA*cos(Dec).",
150 s.join(name,
"decErr"),
151 "1-sigma uncertainty on Dec.",
154 s.join(name,
"ra_dec_Cov"),
155 "Tangent-plane covariance Cov(xi, eta) = Cov(RA*cos(Dec), Dec).",
170 for (; inSrc != inputCatalog.
end() && outSrc != outputCatalog.
end(); ++inSrc, ++outSrc) {
181 _coordErrKey.set(*outSrc, (transform * centroidResult.
getCentroidErr().cast<
double>() *
182 transform.transpose())
192 double maxDistFromPeak)
193 : _doFootprintCheck(doFootprintCheck), _maxDistFromPeak(maxDistFromPeak) {
194 _resetKey = schema.
addField<afw::table::Flag>(schema.
join(name,
"flag_resetToPeak"),
195 "set if CentroidChecker reset the centroid");
196 _failureKey = schema.
find<afw::table::Flag>(schema.
join(name,
"flag")).key;
210 if (_xErrKey.isValid() || _yErrKey.isValid()) {
211 _badErrorKey = schema.addField<afw::table::Flag>(schema.join(name,
"flag_badError"),
212 "Error on x and/or y position is NaN");
221 if ((_xErrKey.isValid() &&
std::isnan(record.
get(_xErrKey))) ||
223 record.
set(_badErrorKey,
true);
224 record.
set(_failureKey,
true);
228 if (!_doFootprintCheck && _maxDistFromPeak < 0.0) {
237 if (footprint->getPeaks().empty()) {
245 double distsq = (x - footX) * (x - footX) + (y - footY) * (y - footY);
247 ((_maxDistFromPeak > 0) && (distsq > _maxDistFromPeak * _maxDistFromPeak))) {
248 record.
set(_xKey, footX);
249 record.
set(_yKey, footY);
250 record.
set(_failureKey,
true);
251 record.
set(_resetKey,
true);
#define LSST_EXCEPT(type,...)
lsst::geom::SpherePoint pixelToSky(lsst::geom::Point2D const &pixel) const
lsst::geom::AffineTransform linearizePixelToSky(lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const
Field< T >::Value get(Key< T > const &key) const
void set(Key< T > const &key, U const &value)
CatalogIterator< typename Internal::iterator > iterator
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
bool isValid() const noexcept
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
std::string join(std::string const &a, std::string const &b) const
Key< T > addField(Field< T > const &field, bool doReplace=false)
SchemaItem< T > find(std::string const &name) const
Key< T > addMapping(Key< T > const &inputKey, bool doReplace=false)
Schema & editOutputSchema()
Schema const getInputSchema() const
typename Base::const_iterator const_iterator
std::shared_ptr< Footprint > getFootprint() const
CentroidChecker(afw::table::Schema &schema, std::string const &name, bool inside=true, double maxDistFromPeak=-1.0)
Check source record produced by a centroid algorithm called "name".
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...
A FunctorKey for CentroidResult.
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
afw::table::CovarianceMatrixKey< ErrElement, 2 > getCentroidErr() const
Return a FunctorKey to just the uncertainty matrix.
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
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.
CatalogT< BaseRecord > BaseCatalog
SortedCatalogT< SourceRecord > SourceCatalog
AngleUnit constexpr radians
Point< double, 2 > Point2D
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
@ FULL_COVARIANCE
The full covariance matrix is provided.
@ NO_UNCERTAINTY
Algorithm provides no uncertainy information at all.
std::ostream & operator<<(std::ostream &os, CentroidResult const &result)
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
geom::Point< CentroidElement, 2 > Centroid
A reusable struct for centroid measurements.
CentroidElement y
y (row) coordinate of the measured position
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
CentroidElement x
x (column) coordinate of the measured position
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x,...
CentroidCov const getCentroidErr() const
Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
ErrElement yErr
standard deviation of y
CentroidResult()
Constructor; initializes everything to NaN.
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
ErrElement xErr
standard deviation of x