32 template<
typename MatchT>
34 std::vector<MatchT>
const & matchList,
38 if (matchList.empty()) {
39 throw LSST_EXCEPT(pexExcept::RuntimeError,
"matchList is empty");
41 std::vector<double>
val;
42 val.reserve(matchList.size());
44 for (
auto const & match: matchList) {
45 val.push_back(match.distance);
50 template<
typename MatchT>
53 std::vector<MatchT>
const & matchList,
57 if (matchList.empty()) {
58 throw LSST_EXCEPT(pexExcept::RuntimeError,
"matchList is empty");
60 std::vector<double>
val;
61 val.reserve(matchList.size());
63 for (
auto const & match: matchList) {
64 auto refPtr = match.first;
65 auto srcPtr = match.second;
66 auto srcX = srcPtr->getX();
67 auto srcY = srcPtr->getY();
68 auto refPos = wcs.
skyToPixel(refPtr->getCoord());
69 auto refX = refPos[0];
70 auto refY = refPos[1];
71 val.push_back(::hypot(srcX - refX, srcY - refY));
76 template<
typename MatchT>
79 std::vector<MatchT>
const & matchList,
83 if (matchList.empty()) {
84 throw LSST_EXCEPT(pexExcept::RuntimeError,
"matchList is empty");
86 std::vector<double>
val;
87 val.reserve(matchList.size());
89 for (
auto const & match: matchList) {
90 auto refPtr = match.first;
91 auto srcPtr = match.second;
92 auto refCoord = refPtr->getCoord();
93 auto srcCoord = wcs.
pixelToSky(srcPtr->getCentroid());
94 auto angSep = refCoord.angularSeparation(*srcCoord);
95 val.push_back(angSep.asRadians());
100 #define INSTANTIATE(MATCH) \
101 template afw::math::Statistics makeMatchStatistics<MATCH>( \
102 std::vector<MATCH> const & matchList, \
104 afw::math::StatisticsControl const & sctrl \
106 template afw::math::Statistics makeMatchStatisticsInPixels<MATCH>( \
107 afw::image::Wcs const & wcs, \
108 std::vector<MATCH> const & matchList, \
110 afw::math::StatisticsControl const & sctrl \
112 template afw::math::Statistics makeMatchStatisticsInRadians<MATCH>( \
113 afw::image::Wcs const & wcs, \
114 std::vector<MATCH> const & matchList, \
116 afw::math::StatisticsControl const & sctrl \
afw::math::Statistics makeMatchStatistics(std::vector< MatchT > const &matchList, int const flags, afw::math::StatisticsControl const &sctrl=afw::math::StatisticsControl())
geom::Point2D skyToPixel(geom::Angle sky1, geom::Angle sky2) const
Convert from sky coordinates (e.g. RA/dec) to pixel positions.
#define INSTANTIATE(MATCH)
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)
Pass parameters to a Statistics objectA class to pass parameters which control how the stats are calc...
Match< SimpleRecord, SourceRecord > ReferenceMatch
afw::math::Statistics makeMatchStatisticsInPixels(afw::image::Wcs const &wcs, std::vector< MatchT > const &matchList, int const flags, afw::math::StatisticsControl const &sctrl=afw::math::StatisticsControl())
#define LSST_EXCEPT(type,...)
afw::math::Statistics makeMatchStatisticsInRadians(afw::image::Wcs const &wcs, std::vector< MatchT > const &matchList, int const flags, afw::math::StatisticsControl const &sctrl=afw::math::StatisticsControl())
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Match< SourceRecord, SourceRecord > SourceMatch