LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
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 {
23  lsst::afw::geom::Point2D position;
24 
25  double getX() const { return position.getX(); }
26  double getY() const { return position.getY(); }
27 
31  operator PTR(lsst::afw::table::SimpleRecord)() const { return record; }
32 
33  bool operator==(RecordProxy const & other) const { return record == other.record; }
34  bool operator!=(RecordProxy const & other) const { return record != other.record; }
35 
45  ) : record(record), position(position) {}
46 
47  explicit RecordProxy() {} // default constructor needed so we can call ProxyVector::resize()
48  };
49 
50  typedef std::vector<RecordProxy> ProxyVector;
51 
53 
55 
56  struct ProxyPair {
59  double distance;
60  double pa;
61 
62  ProxyPair(RecordProxy const & s1, RecordProxy const & s2) : first(s1), second(s2) {
63  double x1 = first.position.getX();
64  double y1 = first.position.getY();
65  double x2 = second.position.getX();
66  double y2 = second.position.getY();
67  distance = std::hypot(x2-x1, y2-y1);
68  pa = std::atan2(y2-y1, x2-x1);
69  }
70  };
71 
73  LSST_CONTROL_FIELD(refFluxField, std::string, "name of flux field in reference catalog");
74  LSST_CONTROL_FIELD(sourceFluxField, std::string, "name of flux field in source catalog");
75  LSST_CONTROL_FIELD(numBrightStars, int, "maximum number of bright reference stars to use");
76  LSST_CONTROL_FIELD(minMatchedPairs, int, "minimum number of matches");
78  LSST_CONTROL_FIELD(maxOffsetPix, double, "maximum translation allowed (pixels)");
79  LSST_CONTROL_FIELD(maxRotationRad, double, "maximum allowed rotation (rad)");
80  LSST_CONTROL_FIELD(angleDiffFrom90, double, "? (deg)");
81  LSST_CONTROL_FIELD(numPointsForShape, int, "number of points in a matching shape");
83 
85  refFluxField("r_flux"),
86  sourceFluxField("slot_ApFlux_flux"),
87  numBrightStars(100),
88  minMatchedPairs(50),
90  maxOffsetPix(300),
91  maxRotationRad(0.02),
92  angleDiffFrom90(0.05),
94  maxDeterminant(0.02)
95  {
96  validate();
97  }
98 
99  void validate() const;
100 
102  };
103 
123  lsst::afw::table::SimpleCatalog const &posRefCat,
124  lsst::afw::table::SourceCatalog const &sourceCat,
125  MatchOptimisticBControl const &control,
126  int posRefBegInd=0,
127  bool verbose = false
128  );
129 
130 }}}
131 
132 #endif
lsst::afw::geom::Point2D position
int numPointsForShape
&quot;number of points in a matching shape&quot; ;
double angleDiffFrom90
&quot;? (deg)&quot; ;
std::vector< ReferenceMatch > ReferenceMatchVector
Definition: fwd.h:97
#define PTR(...)
Definition: base.h:41
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
Definition: config.h:36
RecordProxy(boost::shared_ptr< lsst::afw::table::SimpleRecord > record, lsst::afw::geom::Point2D const &position)
std::vector< RecordProxy > ProxyVector
ProxyPair(RecordProxy const &s1, RecordProxy const &s2)
afwTable::ReferenceMatchVector matchOptimisticB(afwTable::SimpleCatalog const &posRefCat, afwTable::SourceCatalog const &sourceCat, MatchOptimisticBControl const &control, int posRefBegInd, bool verbose)
bool operator!=(RecordProxy const &other) const
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:55
ProxyVector makeProxies(afwTable::SourceCatalog const &sourceCat)
double maxOffsetPix
&quot;maximum translation allowed (pixels)&quot; ;
int numBrightStars
&quot;maximum number of bright reference stars to use&quot; ;
std::string refFluxField
&quot;name of flux field in reference catalog&quot; ;
bool operator==(RecordProxy const &other) const
Point< double, 2 > Point2D
Definition: Point.h:286
double maxRotationRad
&quot;maximum allowed rotation (rad)&quot; ;
std::string sourceFluxField
&quot;name of flux field in source catalog&quot; ;
Record class that must contain a unique ID field and a celestial coordinate field.
Definition: Simple.h:45
int minMatchedPairs
&quot;minimum number of matches&quot; ;
boost::shared_ptr< lsst::afw::table::SimpleRecord > record