Commit 2453a0c2 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

add verbosity parameter to vis2dirty/dirty2vis

parent e8e35562
......@@ -1268,7 +1268,7 @@ template<typename Serv> void wstack_common(
template<typename T, typename Serv> void x2dirty(
const GridderConfig &gconf, const Serv &srv, const mav<T,2> &dirty,
bool do_wstacking, size_t verbosity=0)
bool do_wstacking, size_t verbosity)
{
if (do_wstacking)
{
......@@ -1339,14 +1339,15 @@ template<typename T, typename Serv> void x2dirty(
template<typename T> void vis2dirty(const Baselines &baselines,
const GridderConfig &gconf, const const_mav<uint32_t,1> &idx,
const const_mav<complex<T>,1> &vis, const const_mav<T,1> &wgt,
mav<T,2> &dirty, bool do_wstacking)
mav<T,2> &dirty, bool do_wstacking, size_t verbosity)
{
x2dirty(gconf, makeVisServ(baselines, idx, vis, wgt), dirty, do_wstacking);
x2dirty(gconf, makeVisServ(baselines, idx, vis, wgt), dirty, do_wstacking,
verbosity);
}
template<typename T, typename Serv> void dirty2x(
const GridderConfig &gconf, const const_mav<T,2> &dirty,
const Serv &srv, bool do_wstacking, size_t verbosity=0)
const Serv &srv, bool do_wstacking, size_t verbosity)
{
if (do_wstacking)
{
......@@ -1421,9 +1422,10 @@ template<typename T, typename Serv> void dirty2x(
template<typename T> void dirty2vis(const Baselines &baselines,
const GridderConfig &gconf, const const_mav<uint32_t,1> &idx,
const const_mav<T,2> &dirty, const const_mav<T,1> &wgt,
mav<complex<T>,1> &vis, bool do_wstacking)
mav<complex<T>,1> &vis, bool do_wstacking, size_t verbosity)
{
dirty2x(gconf, dirty, makeVisServ(baselines, idx, vis, wgt), do_wstacking);
dirty2x(gconf, dirty, makeVisServ(baselines, idx, vis, wgt), do_wstacking,
verbosity);
}
......
......@@ -750,7 +750,8 @@ pyarr<uint32_t> PygetIndices(const PyBaselines &baselines,
template<typename T> pyarr<T> vis2dirty2(const PyBaselines &baselines,
const PyGridderConfig &gconf, const py::array &idx_,
const py::array &vis_, const py::object &wgt_, bool do_wstacking)
const py::array &vis_, const py::object &wgt_, bool do_wstacking,
size_t verbosity)
{
auto idx = getPyarr<uint32_t>(idx_, "idx");
auto idx2 = make_const_mav<1>(idx);
......@@ -762,7 +763,8 @@ template<typename T> pyarr<T> vis2dirty2(const PyBaselines &baselines,
auto wgt2 = make_const_mav<1>(wgt);
{
py::gil_scoped_release release;
vis2dirty<T>(baselines, gconf, idx2, vis2, wgt2, dirty2, do_wstacking);
vis2dirty<T>(baselines, gconf, idx2, vis2, wgt2, dirty2, do_wstacking,
verbosity);
}
return dirty;
}
......@@ -788,6 +790,10 @@ wgt: np.array((nvis,), dtype=float with same precision as `vis`, optional
do_wstacking: bool
if True, the full improved w-stacking algorithm is carried out, otherwise
the w values are assumed to be zero.
verbosity: int
0: no output
1: some output
2: detailed output
Returns
=======
......@@ -797,18 +803,22 @@ np.array((nxdirty, nydirty), dtype=float of same precision as `vis`.)
py::array Pyvis2dirty(const PyBaselines &baselines,
const PyGridderConfig &gconf, const py::array &idx,
const py::array &vis, const py::object &wgt, bool do_wstacking)
const py::array &vis, const py::object &wgt, bool do_wstacking,
size_t verbosity)
{
if (isPytype<complex<float>>(vis))
return vis2dirty2<float>(baselines, gconf, idx, vis, wgt, do_wstacking);
return vis2dirty2<float>(baselines, gconf, idx, vis, wgt, do_wstacking,
verbosity);
if (isPytype<complex<double>>(vis))
return vis2dirty2<double>(baselines, gconf, idx, vis, wgt, do_wstacking);
return vis2dirty2<double>(baselines, gconf, idx, vis, wgt, do_wstacking,
verbosity);
myfail("type matching failed: 'vis' has neither type 'c8' nor 'c16'");
}
template<typename T> pyarr<complex<T>> dirty2vis2(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<uint32_t> &idx_,
const pyarr<T> &dirty_, const py::object &wgt_, bool do_wstacking)
const pyarr<T> &dirty_, const py::object &wgt_, bool do_wstacking,
size_t verbosity)
{
auto idx = getPyarr<uint32_t>(idx_, "idx");
auto idx2 = make_const_mav<1>(idx);
......@@ -821,7 +831,8 @@ template<typename T> pyarr<complex<T>> dirty2vis2(const PyBaselines &baselines,
{
py::gil_scoped_release release;
vis2.fill(0);
dirty2vis<T>(baselines, gconf, idx2, dirty2, wgt2, vis2, do_wstacking);
dirty2vis<T>(baselines, gconf, idx2, dirty2, wgt2, vis2, do_wstacking,
verbosity);
}
return vis;
}
......@@ -847,6 +858,10 @@ wgt: np.array((nvis,), same dtype as `dirty`, optional
do_wstacking: bool
if True, the full improved w-stacking algorithm is carried out, otherwise
the w values are assumed to be zero.
verbosity: int
0: no output
1: some output
2: detailed output
Returns
=======
......@@ -855,12 +870,14 @@ np.array((nvis,), dtype=complex of same precision as `dirty`.)
)""";
py::array Pydirty2vis(const PyBaselines &baselines,
const PyGridderConfig &gconf, const py::array &idx, const py::array &dirty,
const py::object &wgt, bool do_wstacking)
const py::object &wgt, bool do_wstacking, size_t verbosity)
{
if (isPytype<float>(dirty))
return dirty2vis2<float>(baselines, gconf, idx, dirty, wgt, do_wstacking);
return dirty2vis2<float>(baselines, gconf, idx, dirty, wgt, do_wstacking,
verbosity);
if (isPytype<double>(dirty))
return dirty2vis2<double>(baselines, gconf, idx, dirty, wgt, do_wstacking);
return dirty2vis2<double>(baselines, gconf, idx, dirty, wgt, do_wstacking,
verbosity);
myfail("type matching failed: 'dirty' has neither type 'f4' nor 'f8'");
}
......@@ -1090,9 +1107,9 @@ PYBIND11_MODULE(nifty_gridder, m)
m.def("get_correlations", &Pyget_correlations<double>, "baselines"_a, "gconf"_a,
"idx"_a, "du"_a, "dv"_a, "wgt"_a=None);
m.def("vis2dirty",&Pyvis2dirty, vis2dirty_DS, "baselines"_a, "gconf"_a,
"idx"_a, "vis"_a, "wgt"_a=None, "do_wstacking"_a=false);
"idx"_a, "vis"_a, "wgt"_a=None, "do_wstacking"_a=false, "verbosity"_a=0);
m.def("dirty2vis",&Pydirty2vis, "baselines"_a, dirty2vis_DS, "gconf"_a,
"idx"_a, "dirty"_a, "wgt"_a=None, "do_wstacking"_a=false);
"idx"_a, "dirty"_a, "wgt"_a=None, "do_wstacking"_a=false, "verbosity"_a=0);
m.def("ms2dirty", &Pyms2dirty, ms2dirty_DS, "uvw"_a, "freq"_a, "ms"_a,
"wgt"_a=None, "npix_x"_a, "npix_y"_a, "pixsize_x"_a, "pixsize_y"_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