Commit 31f59aa7 authored by Martin Reinecke's avatar Martin Reinecke

wrap enhanced GridderConfig constructor

parent ef5aea1d
...@@ -314,9 +314,13 @@ class PyGridderConfig: public GridderConfig ...@@ -314,9 +314,13 @@ class PyGridderConfig: public GridderConfig
{ {
public: public:
using GridderConfig::GridderConfig; using GridderConfig::GridderConfig;
PyGridderConfig(size_t nxdirty, size_t nydirty, size_t nu_, size_t nv_,
double epsilon, double pixsize_x, double pixsize_y, size_t nthreads_)
: GridderConfig(nxdirty, nydirty, nu_, nv_, epsilon, pixsize_x, pixsize_y, nthreads_) {}
PyGridderConfig(size_t nxdirty, size_t nydirty, double epsilon, PyGridderConfig(size_t nxdirty, size_t nydirty, double epsilon,
double pixsize_x, double pixsize_y, size_t nthreads) double pixsize_x, double pixsize_y, size_t nthreads_)
: GridderConfig(nxdirty, nydirty, epsilon, pixsize_x, pixsize_y, nthreads) {} : GridderConfig(nxdirty, nydirty, epsilon, pixsize_x, pixsize_y, nthreads_) {}
template<typename T> pyarr<T> apply_taper2(const pyarr<T> &img, bool divide) const template<typename T> pyarr<T> apply_taper2(const pyarr<T> &img, bool divide) const
{ {
...@@ -1064,6 +1068,8 @@ PYBIND11_MODULE(nifty_gridder, m) ...@@ -1064,6 +1068,8 @@ PYBIND11_MODULE(nifty_gridder, m)
py::class_<PyGridderConfig> (m, "GridderConfig", GridderConfig_DS) py::class_<PyGridderConfig> (m, "GridderConfig", GridderConfig_DS)
.def(py::init<size_t, size_t, double, double, double, size_t>(),"nxdirty"_a, .def(py::init<size_t, size_t, double, double, double, size_t>(),"nxdirty"_a,
"nydirty"_a, "epsilon"_a, "pixsize_x"_a, "pixsize_y"_a, "nthreads"_a=1) "nydirty"_a, "epsilon"_a, "pixsize_x"_a, "pixsize_y"_a, "nthreads"_a=1)
.def(py::init<size_t, size_t, size_t, size_t, double, double, double, size_t>(),"nxdirty"_a,
"nydirty"_a, "nu"_a, "nv"_a, "epsilon"_a, "pixsize_x"_a, "pixsize_y"_a, "nthreads"_a=1)
.def("Nxdirty", &PyGridderConfig::Nxdirty) .def("Nxdirty", &PyGridderConfig::Nxdirty)
.def("Nydirty", &PyGridderConfig::Nydirty) .def("Nydirty", &PyGridderConfig::Nydirty)
.def("Epsilon", &PyGridderConfig::Epsilon) .def("Epsilon", &PyGridderConfig::Epsilon)
...@@ -1088,17 +1094,19 @@ PYBIND11_MODULE(nifty_gridder, m) ...@@ -1088,17 +1094,19 @@ PYBIND11_MODULE(nifty_gridder, m)
// __getstate__ // __getstate__
[](const PyGridderConfig & gc) { [](const PyGridderConfig & gc) {
// Encode object state in tuple // Encode object state in tuple
return py::make_tuple(gc.Nxdirty(), gc.Nydirty(), gc.Epsilon(), return py::make_tuple(gc.Nxdirty(), gc.Nydirty(), gc.Nu(), gc.Nv(),
gc.Epsilon(),
gc.Pixsize_x(), gc.Pixsize_y(), gc.Nthreads()); gc.Pixsize_x(), gc.Pixsize_y(), gc.Nthreads());
}, },
// __setstate__ // __setstate__
[](py::tuple t) { [](py::tuple t) {
myassert(t.size()==6,"Invalid state"); myassert(t.size()==8,"Invalid state");
// Reconstruct from tuple // Reconstruct from tuple
return PyGridderConfig(t[0].cast<size_t>(), t[1].cast<size_t>(), return PyGridderConfig(t[0].cast<size_t>(), t[1].cast<size_t>(),
t[2].cast<double>(), t[3].cast<double>(), t[2].cast<size_t>(), t[3].cast<size_t>(),
t[4].cast<double>(), t[5].cast<size_t>()); t[4].cast<double>(), t[5].cast<double>(),
t[6].cast<double>(), t[7].cast<size_t>());
})); }));
m.def("getIndices", PygetIndices, getIndices_DS, "baselines"_a, m.def("getIndices", PygetIndices, getIndices_DS, "baselines"_a,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment