24 #ifndef LSST_MEAS_BASE_PYTHON_H
25 #define LSST_MEAS_BASE_PYTHON_H
27 #include "pybind11/pybind11.h"
31 #include "lsst/afw/image/Calib.h"
32 #include "lsst/afw/image/Wcs.h"
33 #include "lsst/afw/table/fwd.h"
34 #include "lsst/afw/table/Schema.h"
35 #include "lsst/afw/table/SchemaMapper.h"
42 namespace py = pybind11;
43 using namespace pybind11::literals;
53 template <
class Algorithm,
class PyAlg>
55 cls.def(py::init<
typename Algorithm::Control
const &,
57 afw::table::Schema &>(),
58 "ctrl"_a,
"name"_a,
"schema"_a);
71 template <
class Algorithm,
class PyAlg>
86 template <
class Algorithm,
class PyAlg>
91 declareAlgorithmConstructor<Algorithm>(clsAlgorithm);
96 clsAlgorithm.def(
"fail", &Algorithm::fail,
"measRecord"_a,
"error"_a=NULL);
97 clsAlgorithm.def(
"measure", &Algorithm::measure,
"record"_a,
"exposure"_a);
115 template <
class Algorithm,
class Control,
class PyAlg,
class PyCtrl>
117 declareAlgorithm<Algorithm>(clsAlgorithm);
122 clsControl.def(py::init<>());
147 template <
class Algorithm,
class Control,
class Transform,
class PyAlg,
class PyCtrl,
class PyXform>
149 declareAlgorithm<Algorithm, Control>(clsAlgorithm, clsControl);
154 clsTransform.def(py::init<
typename Transform::Control
const &,
156 afw::table::SchemaMapper &>(),
157 "ctrl"_a,
"name"_a,
"mapper"_a);
160 clsTransform.def(
"__call__", [](Transform
const &
self,
161 afw::table::SourceCatalog
const & inputCatalog,
162 afw::table::BaseCatalog & outputCatalog,
163 afw::image::Wcs
const & wcs,
164 afw::image::Calib
const &calib) {
165 return self(inputCatalog, outputCatalog, wcs, calib);
166 },
"inputCatalog"_a,
"outputCatalog"_a,
"wcs"_a,
"calib"_a);
void declareAlgorithm(PyAlg &clsAlgorithm)
Wrap the implicit API used by meas_base's algorithms.
std::enable_if<!std::is_abstract< Algorithm >::value, void >::type declareAlgorithmConstructor(PyAlg &cls)
Wrap the standard algorithm constructor.