Commit 7faf4d5c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

re-introduced complex-valued dirty images

parent 22a2e28b
......@@ -1000,7 +1000,7 @@ template<typename T, typename T2> void apply_wcorr(const GridderConfig<T> &gconf
template<typename T> void vis2dirty_wstack(const Baselines<T> &baselines,
const GridderConfig<T> &gconf, const const_mav<uint32_t,1> &idx,
const const_mav<complex<T>,1> &vis, mav<T,2> &dirty)
const const_mav<complex<T>,1> &vis, mav<complex<T>,2> &dirty)
{
auto nx_dirty=gconf.Nxdirty();
auto ny_dirty=gconf.Nydirty();
......@@ -1082,7 +1082,7 @@ myassert(cnt==nvis_plane[iw],"must not happen 2");
gconf.apply_wscreen(tdirty, tdirty, wcur, false);
for (size_t i=0; i<nx_dirty; ++i)
for (size_t j=0; j<ny_dirty; ++j)
dirty(i,j) += tdirty(i,j).real();
dirty(i,j) += tdirty(i,j);
}
}
// correct for w gridding
......@@ -1093,7 +1093,7 @@ cout << "applying correction for gridding in w direction" << endl;
template<typename T> void dirty2vis_wstack(const Baselines<T> &baselines,
const GridderConfig<T> &gconf, const const_mav<uint32_t,1> &idx,
const const_mav<T,2> &dirty, mav<complex<T>,1> &vis)
const const_mav<complex<T>,2> &dirty, mav<complex<T>,1> &vis)
{
auto nx_dirty=gconf.Nxdirty();
auto ny_dirty=gconf.Nydirty();
......
......@@ -681,7 +681,7 @@ template<typename T> pyarr<uint32_t> getIndices(const PyBaselines<T> &baselines,
return res;
}
template<typename T> pyarr<T> Pyvis2dirty_wstack(const PyBaselines<T> &baselines,
template<typename T> pyarr<complex<T>> Pyvis2dirty_wstack(const PyBaselines<T> &baselines,
const PyGridderConfig<T> &gconf, const pyarr<uint32_t> &idx_,
const pyarr<complex<T>> &vis_)
{
......@@ -689,7 +689,7 @@ template<typename T> pyarr<T> Pyvis2dirty_wstack(const PyBaselines<T> &baselines
auto ny_dirty=gconf.Nydirty();
auto idx2=make_const_mav<1>(idx_);
auto vis2=make_const_mav<1>(vis_);
auto dirty = makeArray<T>({nx_dirty, ny_dirty});
auto dirty = makeArray<complex<T>>({nx_dirty, ny_dirty});
auto dirty2=make_mav<2>(dirty);
{
py::gil_scoped_release release;
......@@ -700,7 +700,7 @@ template<typename T> pyarr<T> Pyvis2dirty_wstack(const PyBaselines<T> &baselines
template<typename T> pyarr<complex<T>> Pydirty2vis_wstack(const PyBaselines<T> &baselines,
const PyGridderConfig<T> &gconf, const pyarr<uint32_t> &idx_,
const pyarr<T> &dirty_)
const pyarr<complex<T>> &dirty_)
{
auto idx2=make_const_mav<1>(idx_);
auto nvis = idx2.shape(0);
......
......@@ -76,7 +76,7 @@ def test_adjointness_wgridding(nxdirty, nydirty, nrow, nchan, epsilon):
dirty = np.random.rand(conf.Nxdirty(), conf.Nydirty())-0.5
dirty2 = ng.vis2dirty_wstack(bl, conf, idx, vis)
vis2 = ng.dirty2vis_wstack(bl, conf, idx, dirty)
assert_allclose(np.vdot(vis, vis2).real, np.vdot(dirty2, dirty),
assert_allclose(np.vdot(vis, vis2), np.vdot(dirty2, dirty),
rtol=epsilon)
......@@ -342,5 +342,5 @@ def test_wgridder_against_wdft(nxdirty, nydirty, nchan, nrow, fov, epsilon):
vis = bl.ms2vis(ms, idx)
uvw = bl.effectiveuvw(idx)
res0 = ng.vis2dirty_wstack(bl, conf, idx, vis)
res1 = _dft(uvw, vis, conf, True).real
res1 = _dft(uvw, vis, conf, True)
assert_(_l2error(res0, res1) < epsilon)
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