diff --git a/nifty_gridder.cc b/nifty_gridder.cc index df208d514da5ae1f37517d01363bd0735f9d2acd..5cd124a6e3c3dae7d2babb31f412a7d9b2d8e1fc 100644 --- a/nifty_gridder.cc +++ b/nifty_gridder.cc @@ -552,6 +552,15 @@ template<typename T> class GridderConfig T beta; vector<T> cfu, cfv; + complex<T> wscreen(double x, double y, double w, bool adjoint) const + { + constexpr double pi = 3.141592653589793238462643383279502884197; + double n = cos(sqrt(x+y)), xn = 1./n; + double phase = 2*pi*w*(n-1); + if (adjoint) phase *= -1; + return complex<T>(cos(phase)*xn, sin(phase)*xn); + } + public: GridderConfig(size_t nxdirty, size_t nydirty, double epsilon, double pixsize_x, double pixsize_y) @@ -707,14 +716,6 @@ template<typename T> class GridderConfig } return tmp; } - complex<T> wscreen(double x, double y, double w, bool adjoint) const - { - constexpr double pi = 3.141592653589793238462643383279502884197; - double n = cos(sqrt(x+y)), xn = 1./n; - double phase = 2*pi*w*(n-1); - if (adjoint) phase *= -1; - return complex<T>(cos(phase)*xn, sin(phase)*xn); - } inline void getpix(T u_in, T v_in, T &u, T &v, int &iu0, int &iv0) const { u=fmodulo(u_in*psx, T(1))*nu, @@ -745,17 +746,16 @@ template<typename T> class GridderConfig { double fy = y0+j*psy; auto ws = wscreen(fx, fy*fy, w, adjoint); - res[ny_dirty*i+j] = dirty[ny_dirty*i+j]*ws; - size_t i2 = nx_dirty-i, - j2 = ny_dirty-j; + res[ny_dirty*i+j] = dirty[ny_dirty*i+j]*ws; // lower left + size_t i2 = nx_dirty-i, j2 = ny_dirty-j; if ((i>0)&&(i<i2)) { - res[ny_dirty*i2+j] = dirty[ny_dirty*i2+j]*ws; + res[ny_dirty*i2+j] = dirty[ny_dirty*i2+j]*ws; // lower right if ((j>0)&&(j<j2)) - res[ny_dirty*i2+j2] = dirty[ny_dirty*i2+j2]*ws; + res[ny_dirty*i2+j2] = dirty[ny_dirty*i2+j2]*ws; // upper right } if ((j>0)&&(j<j2)) - res[ny_dirty*i+j2] = dirty[ny_dirty*i+j2]*ws; + res[ny_dirty*i+j2] = dirty[ny_dirty*i+j2]*ws; // upper left } } }