diff --git a/gridder_cxx.h b/gridder_cxx.h index 3fcbcb22813595b02826a4074bd905885f0b620b..e096f96267877f063b0381f5a7c5cc96df9b0ff5 100644 --- a/gridder_cxx.h +++ b/gridder_cxx.h @@ -530,7 +530,7 @@ class GridderConfig double beta; vector<double> cfu, cfv; size_t nthreads; -// double ushift, vshift; + double ushift, vshift; int maxiu0, maxiv0; complex<double> wscreen(double x, double y, double w, bool adjoint) const @@ -554,7 +554,7 @@ class GridderConfig nu(max(2*nsafe,2*nx_dirty)), nv(max(2*nsafe,2*ny_dirty)), beta(2.3*supp), cfu(nx_dirty), cfv(ny_dirty), nthreads(nthreads_), -// ushift(-supp*0.5+1), vshift(-supp*0.5+1), + ushift(supp*(-0.5)+1+nu), vshift(supp*(-0.5)+1+nv), maxiu0((nu+nsafe)-supp), maxiv0((nv+nsafe)-supp) { myassert((nx_dirty&1)==0, "nx_dirty must be even"); @@ -673,12 +673,10 @@ class GridderConfig void getpix(double u_in, double v_in, double &u, double &v, int &iu0, int &iv0) const { - u=fmod1(u_in*psx)*nu, - iu0 = int(u-supp*0.5 + 1 + nu) - nu; - iu0 = min(iu0, maxiu0); + u=fmod1(u_in*psx)*nu; + iu0 = min(int(u+ushift)-int(nu), maxiu0); v=fmod1(v_in*psy)*nv; - iv0 = int(v-supp*0.5 + 1 + nv) - nv; - iv0 = min(iv0, maxiv0); + iv0 = min(int(v+vshift)-int(nv), maxiv0); } template<typename T> void apply_wscreen(const const_mav<complex<T>,2> &dirty, diff --git a/nifty_gridder.cc b/nifty_gridder.cc index 8dbc9c1a96748f5439f8f154ca6fc4de7f68bc41..46f73f90c5042e09e1422d94c2d7cef12a877b25 100644 --- a/nifty_gridder.cc +++ b/nifty_gridder.cc @@ -587,9 +587,9 @@ template<typename T> pyarr<complex<T>> Pygrid2vis_c( auto wgt2 = make_const_mav<1>(wgt); auto res = makeArray<complex<T>>({nvis}); auto vis = make_mav<1>(res); - vis.fill(0); { py::gil_scoped_release release; + vis.fill(0); grid2vis_c<T>(baselines, gconf, idx2, grid2, vis, wgt2); } return res; diff --git a/test.py b/test.py index bfe8fc48e08aae6ad14ec707c96aa4b864aa2984..6b154ce9475f178723582b86d97b27bbd06827ba 100644 --- a/test.py +++ b/test.py @@ -102,7 +102,7 @@ def test_adjointness_ms2dirty(nxdirty, nydirty, nrow, nchan, epsilon, singleprec if wgt is not None: wgt = wgt.astype("f4") dirty2 = ng.ms2dirty(uvw, freq, ms, wgt, nxdirty, nydirty, pixsizex, - pixsizey, epsilon, wstacking, nthreads, 2).astype("f8") + pixsizey, epsilon, wstacking, nthreads, 0).astype("f8") ms2 = ng.dirty2ms(uvw, freq, dirty, wgt, pixsizex, pixsizey, epsilon, wstacking, nthreads, 0).astype("c16") tol = 5e-5 if singleprec else 5e-13