24 #include "pybind11/pybind11.h"
26 #include "numpy/arrayobject.h"
27 #include "ndarray/pybind11.h"
30 #include "lsst/afw/table/BaseRecord.h"
31 #include "lsst/afw/table/BaseTable.h"
32 #include "lsst/afw/table/Catalog.h"
34 namespace py = pybind11;
35 using namespace pybind11::literals;
42 using PySamplingObjective = py::class_<SamplingObjective, std::shared_ptr<SamplingObjective>>;
43 using PySampler = py::class_<Sampler, std::shared_ptr<Sampler>>;
45 PYBIND11_PLUGIN(sampler) {
46 py::module::import(
"lsst.afw.table");
47 py::module::import(
"lsst.meas.modelfit.mixture");
48 py::module::import(
"lsst.meas.modelfit.likelihood");
52 if (_import_array() < 0) {
53 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
57 PySamplingObjective clsSamplingObjective(mod,
"SamplingObjective");
58 clsSamplingObjective.def(
"getParameterDim", &SamplingObjective::getParameterDim);
59 clsSamplingObjective.def(
"__call__", &SamplingObjective::operator(),
"parameters"_a,
"sample"_a);
61 PySampler clsSampler(mod,
"Sampler");
62 clsSampler.def(
"run", &Sampler::run,
"objective"_a,
"proposal"_a,
"samples"_a);