LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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  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 
48  ) : record(record), position(position) {}
49 
50  explicit RecordProxy() {} // default constructor needed so we can call ProxyVector::resize()
51  };
52 
53  typedef std::vector<RecordProxy> ProxyVector;
54 
56  afw::image::Wcs const& distortedWcs,
57  afw::image::Wcs const& tanWcs
58  );
59 
61  afw::image::Wcs 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");
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");
92 
94  refFluxField("r_flux"),
95  sourceFluxField("slot_ApFlux_flux"),
96  numBrightStars(100),
97  minMatchedPairs(50),
99  maxOffsetPix(300),
100  maxRotationDeg(1.0),
101  allowedNonperpDeg(3.0),
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::image::Wcs const& wcs,
137  int posRefBegInd=0,
138  bool verbose = false
139  );
140 
141 }}}
142 
143 #endif
double allowedNonperpDeg
&quot;allowed non-perpendicularity of x and y axes (deg)&quot; ;
bool operator!=(RecordProxy const &other) const
ProxyPair(RecordProxy const &s1, RecordProxy const &s2)
std::string sourceFluxField
&quot;name of flux field in source catalog&quot; ;
bool operator==(RecordProxy const &other) const
#define PTR(...)
Definition: base.h:41
Point< double, 2 > Point2D
Definition: Point.h:286
tbl::Key< int > wcs
std::vector< ReferenceMatch > ReferenceMatchVector
Definition: fwd.h:97
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
Definition: config.h:36
boost::shared_ptr< lsst::afw::table::SimpleRecord > record
double maxRotationDeg
&quot;maximum allowed frame rotation (deg)&quot; ;
lsst::afw::table::ReferenceMatchVector matchOptimisticB(lsst::afw::table::SimpleCatalog const &posRefCat, lsst::afw::table::SourceCatalog const &sourceCat, MatchOptimisticBControl const &control, afw::image::Wcs const &wcs, int posRefBegInd=0, bool verbose=false)
int numBrightStars
&quot;maximum number of bright reference stars to use&quot; ;
double maxOffsetPix
&quot;maximum allowed frame translation (pixels)&quot; ;
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
double matchingAllowancePix
&quot;maximum allowed distance between reference objects and sources (pixels)&quot; ;
int minMatchedPairs
&quot;minimum number of matches&quot; ;
std::string refFluxField
&quot;name of flux field in reference catalog&quot; ;
lsst::afw::geom::Point2D position
std::vector< RecordProxy > ProxyVector
ProxyVector makeProxies(lsst::afw::table::SourceCatalog const &sourceCat, afw::image::Wcs const &distortedWcs, afw::image::Wcs const &tanWcs)
Record class that must contain a unique ID field and a celestial coordinate field.
Definition: Simple.h:46
int numPointsForShape
&quot;number of points in a matching shape&quot; ;
RecordProxy(boost::shared_ptr< lsst::afw::table::SimpleRecord > record, lsst::afw::geom::Point2D const &position)