lsst.meas.astrom  14.0-7-g0d69b06+3
matchOptimisticB.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #if !defined(LSST_MEAS_ASTROM_MATCHOPTIMISTICB_H)
3 #define LSST_MEAS_ASTROM_MATCHOPTIMISTICB_H
4 
5 #include <cmath>
6 #include <string>
7 #include <vector>
8 
9 #include "lsst/pex/config.h"
10 #include "lsst/afw/table/Source.h"
11 #include "lsst/afw/table/Match.h"
12 
13 namespace lsst {
14 namespace meas {
15 namespace astrom {
16 
21  struct RecordProxy {
24  mutable bool used; // set true if this star object has already been used for a match
25  // mutable to allow freezing the fundamental object data using const
26  // while keeping track of which objects have been used in each search
27 
28  double getX() const { return position.getX(); }
29  double getY() const { return position.getY(); }
30 
34  operator PTR(lsst::afw::table::SimpleRecord)() const { return record; }
35 
36  bool operator==(RecordProxy const & other) const { return record == other.record; }
37  bool operator!=(RecordProxy const & other) const { return record != other.record; }
38 
47  lsst::afw::geom::Point2D const & position
48  ) : record(record), position(position) {}
49 
50  explicit RecordProxy() {} // default constructor needed so we can call ProxyVector::resize()
51  };
52 
54 
55  ProxyVector makeProxies(lsst::afw::table::SourceCatalog const & sourceCat,
56  afw::geom::SkyWcs const& distortedWcs,
57  afw::geom::SkyWcs const& tanWcs
58  );
59 
60  ProxyVector makeProxies(lsst::afw::table::SimpleCatalog const & posRefCat,
61  afw::geom::SkyWcs const& tanWcs
62  );
63 
64  struct ProxyPair {
67  double distance;
68  double pa;
69 
70  ProxyPair(RecordProxy const & s1, RecordProxy const & s2) : first(s1), second(s2) {
71  double x1 = first.position.getX();
72  double y1 = first.position.getY();
73  double x2 = second.position.getX();
74  double y2 = second.position.getY();
75  distance = std::hypot(x2-x1, y2-y1);
76  pa = std::atan2(y2-y1, x2-x1);
77  }
78  };
79 
81  LSST_CONTROL_FIELD(refFluxField, std::string, "name of flux field in reference catalog");
82  LSST_CONTROL_FIELD(sourceFluxField, std::string, "name of flux field in source catalog");
83  LSST_CONTROL_FIELD(numBrightStars, int, "maximum number of bright reference stars to use");
84  LSST_CONTROL_FIELD(minMatchedPairs, int, "minimum number of matches");
85  LSST_CONTROL_FIELD(matchingAllowancePix, double,
86  "maximum allowed distance between reference objects and sources (pixels)");
87  LSST_CONTROL_FIELD(maxOffsetPix, double, "maximum allowed frame translation (pixels)");
88  LSST_CONTROL_FIELD(maxRotationDeg, double, "maximum allowed frame rotation (deg)");
89  LSST_CONTROL_FIELD(allowedNonperpDeg, double, "allowed non-perpendicularity of x and y axes (deg)");
90  LSST_CONTROL_FIELD(numPointsForShape, int, "number of points in a matching shape");
91  LSST_CONTROL_FIELD(maxDeterminant, double, "?");
92 
94  refFluxField("r_flux"),
95  sourceFluxField("slot_ApFlux_flux"),
96  numBrightStars(100),
97  minMatchedPairs(50),
98  matchingAllowancePix(10.0),
99  maxOffsetPix(300),
100  maxRotationDeg(1.0),
101  allowedNonperpDeg(3.0),
102  numPointsForShape(6),
103  maxDeterminant(0.02)
104  {
105  validate();
106  }
107 
108  void validate() const;
109 
111  };
112 
133  lsst::afw::table::SimpleCatalog const &posRefCat,
134  lsst::afw::table::SourceCatalog const &sourceCat,
135  MatchOptimisticBControl const &control,
136  afw::geom::SkyWcs const& wcs,
137  int posRefBegInd=0,
138  bool verbose = false
139  );
140 
141 }}}
142 
143 #endif
bool operator==(RecordProxy const &other) const
lsst::afw::geom::Point2D position
bool operator!=(RecordProxy const &other) const
#define PTR(...)
ProxyVector makeProxies(lsst::afw::table::SourceCatalog const &sourceCat, afw::geom::SkyWcs const &distortedWcs, afw::geom::SkyWcs const &tanWcs)
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
RecordProxy(boost::shared_ptr< lsst::afw::table::SimpleRecord > record, lsst::afw::geom::Point2D const &position)
Construct a RecordProxy.
std::vector< RecordProxy > ProxyVector
ProxyPair(RecordProxy const &s1, RecordProxy const &s2)
T atan2(T... args)
STL class.
validate
T hypot(T... args)
STL class.
A wrapper around a SimpleRecord or SourceRecord that allows us to record a pixel position in a way th...
lsst::afw::table::ReferenceMatchVector matchOptimisticB(lsst::afw::table::SimpleCatalog const &posRefCat, lsst::afw::table::SourceCatalog const &sourceCat, MatchOptimisticBControl const &control, afw::geom::SkyWcs const &wcs, int posRefBegInd=0, bool verbose=false)
Match sources to stars in a position reference catalog using optimistic pattern matching B...
boost::shared_ptr< lsst::afw::table::SimpleRecord > record