22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
27 #include "lsst/pex/config/python.h"
30 namespace py = pybind11;
31 using namespace pybind11::literals;
38 static void declareRecordProxy(py::module &mod) {
39 py::class_<RecordProxy, std::shared_ptr<RecordProxy>> cls(mod,
"RecordProxy");
41 cls.def_readwrite(
"record", &RecordProxy::record);
42 cls.def_readwrite(
"position", &RecordProxy::position);
43 cls.def_readwrite(
"used", &RecordProxy::used);
45 cls.def(py::init<std::shared_ptr<afw::table::SimpleRecord>, afw::geom::Point2D
const &>(),
"record"_a,
50 cls.def(
"__eq__", &RecordProxy::operator==, py::is_operator());
51 cls.def(
"__ne__", &RecordProxy::operator!=, py::is_operator());
53 cls.def(
"getX", &RecordProxy::getX);
54 cls.def(
"getY", &RecordProxy::getY);
57 static void declareProxyPair(py::module &mod) {
58 py::class_<ProxyPair, std::shared_ptr<ProxyPair>> cls(mod,
"ProxyPair");
60 cls.def_readwrite(
"first", &ProxyPair::first);
61 cls.def_readwrite(
"second", &ProxyPair::second);
62 cls.def_readwrite(
"distance", &ProxyPair::distance);
63 cls.def_readwrite(
"pa", &ProxyPair::pa);
65 cls.def(py::init<RecordProxy const &, RecordProxy const &>(),
"s1"_a,
"s2"_a);
68 static void declareMatchOptimisticBControl(py::module &mod) {
69 py::class_<MatchOptimisticBControl> cls(mod,
"MatchOptimisticBControl");
71 cls.def(py::init<>());
73 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, refFluxField);
74 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, sourceFluxField);
75 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, numBrightStars);
76 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, minMatchedPairs);
77 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, matchingAllowancePix);
78 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, maxOffsetPix);
79 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, maxRotationDeg);
80 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, allowedNonperpDeg);
81 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, numPointsForShape);
82 LSST_DECLARE_CONTROL_FIELD(cls, MatchOptimisticBControl, maxDeterminant);
84 cls.def(
"validate", &MatchOptimisticBControl::validate);
90 py::module mod(
"matchOptimisticB");
92 declareRecordProxy(mod);
93 declareProxyPair(mod);
94 declareMatchOptimisticBControl(mod);
96 mod.def(
"makeProxies", (
ProxyVector(*)(afw::table::SourceCatalog
const &, afw::image::Wcs
const &,
97 afw::image::Wcs
const &)) &
99 "sourceCat"_a,
"distortedWcs"_a,
"tanWcs"_a);
100 mod.def(
"makeProxies",
101 (
ProxyVector(*)(afw::table::SimpleCatalog
const &, afw::image::Wcs
const &)) & makeProxies,
102 "posRefCat"_a,
"tanWcs"_a);
104 mod.def(
"matchOptimisticB", &
matchOptimisticB,
"posRefCat"_a,
"sourceCat"_a,
"control"_a,
"wcs"_a,
105 "posRefBegInd"_a = 0,
"verbose"_a =
false);
PYBIND11_PLUGIN(makeMatchStatistics)
std::vector< RecordProxy > ProxyVector
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)
Match sources to stars in a position reference catalog using optimistic pattern matching B...
ProxyVector makeProxies(lsst::afw::table::SourceCatalog const &sourceCat, afw::image::Wcs const &distortedWcs, afw::image::Wcs const &tanWcs)