Commit d62f5f69 authored by Philipp Arras's avatar Philipp Arras
Browse files

Add function which returns all effective uvws

parent 59119185
......@@ -412,6 +412,24 @@ template<typename T> class Baselines
np.array((nvis,), dtype=np.complex)
The visibility data for the index array
)""";
pyarr_c<T> ind2effectiveuvw(const pyarr_c<uint32_t> &idx_) const
{
checkArray(idx_, "idx", {0});
size_t nvis = size_t(idx_.shape(0));
auto idx = idx_.template unchecked<1>();
auto res_=makeArray<T>({nvis, 3});
auto res = res_.template mutable_unchecked<2>();
for (size_t i=0; i<nvis; i++)
{
auto uvw = effectiveCoord(idx(i));
res(i,0) = uvw.u;
res(i,1) = uvw.v;
res(i,2) = uvw.w;
}
return res_;
}
template<typename T2> pyarr_c<T2> ms2vis(const pyarr<T2> &ms_,
const pyarr_c<uint32_t> &idx_) const
{
......@@ -1528,6 +1546,7 @@ PYBIND11_MODULE(nifty_gridder, m)
.def ("Nchannels",&Baselines<double>::Nchannels)
.def ("ms2vis",&Baselines<double>::ms2vis<complex<double>>,
Baselines<double>::ms2vis_DS, "ms"_a, "idx"_a)
.def ("ind2effectiveuvw",&Baselines<double>::ind2effectiveuvw, "idx"_a)
.def ("vis2ms",&Baselines<double>::vis2ms<complex<double>>,
Baselines<double>::vis2ms_DS, "vis"_a, "idx"_a, "ms_in"_a=None);
py::class_<GridderConfig<double>> (m, "GridderConfig", GridderConfig_DS)
......
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