22 #include "pybind11/pybind11.h" 23 #include "pybind11/stl.h" 28 #include "numpy/arrayobject.h" 29 #include "ndarray/pybind11.h" 31 #include "lsst/afw/geom/Box.h" 32 #include "lsst/afw/image/TanWcs.h" 33 #include "lsst/afw/table/Match.h" 36 namespace py = pybind11;
45 template <
typename MatchT>
46 static void declareCreateWcsWithSip(py::module &mod, std::string
const &name) {
47 py::class_<CreateWcsWithSip<MatchT>, std::shared_ptr<CreateWcsWithSip<MatchT>>> cls(mod, name.c_str());
49 cls.def(py::init<std::vector<MatchT>
const &, afw::image::Wcs
const &,
int const,
50 afw::geom::Box2I
const &,
int const>(),
51 "matches"_a,
"linearWcs"_a,
"order"_a,
"bbox"_a = afw::geom::Box2I(),
"ngrid"_a = 0);
53 cls.def(
"getNewWcs", &CreateWcsWithSip<MatchT>::getNewWcs);
54 cls.def(
"getScatterInPixels", &CreateWcsWithSip<MatchT>::getScatterInPixels);
55 cls.def(
"getScatterOnSky", &CreateWcsWithSip<MatchT>::getScatterOnSky);
56 cls.def(
"getLinearScatterInPixels", &CreateWcsWithSip<MatchT>::getLinearScatterInPixels);
57 cls.def(
"getLinearScatterOnSky", &CreateWcsWithSip<MatchT>::getLinearScatterOnSky);
58 cls.def(
"getOrder", &CreateWcsWithSip<MatchT>::getOrder);
59 cls.def(
"getNPoints", &CreateWcsWithSip<MatchT>::getNPoints);
60 cls.def(
"getNGrid", &CreateWcsWithSip<MatchT>::getNGrid);
62 mod.def(
"makeCreateWcsWithSip", &makeCreateWcsWithSip<MatchT>,
"matches"_a,
"linearWcs"_a,
"order"_a,
63 "bbox"_a = afw::geom::Box2I(),
"ngrid"_a = 0);
69 py::module mod(
"createWcsWithSip");
72 if (_import_array() < 0) {
73 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
77 declareCreateWcsWithSip<afw::table::ReferenceMatch>(mod,
"CreateWcsWithSipReferenceMatch");
78 declareCreateWcsWithSip<afw::table::SourceMatch>(mod,
"CreateWcsWithSipSourceMatch");
PYBIND11_PLUGIN(createWcsWithSip)