diff --git a/nifty_gridder.cc b/nifty_gridder.cc index 92b275f04baccf73cbb184e82ac05b63ec760614..d68df5db02d949a03a9871c8792d180d8e27ed62 100644 --- a/nifty_gridder.cc +++ b/nifty_gridder.cc @@ -423,7 +423,7 @@ template<typename T> class Baselines The visibility data for the index array )"""; - pyarr_c<T> ind2effectiveuvw(const pyarr_c<uint32_t> &idx_) const + pyarr_c<T> effectiveuvw(const pyarr_c<uint32_t> &idx_) const { checkArray(idx_, "idx", {0}); size_t nvis = size_t(idx_.shape(0)); @@ -1477,7 +1477,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 ("effectiveuvw",&Baselines<double>::effectiveuvw, "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) diff --git a/profile.py b/profile.py deleted file mode 100644 index dcb1d40dfaccdc732ef74798ca25df9e96a9dceb..0000000000000000000000000000000000000000 --- a/profile.py +++ /dev/null @@ -1,41 +0,0 @@ -import nifty_gridder as ng -from time import time -import numpy as np - - -def _wscreen(npix, dst, w): - dc = (np.linspace(start=-npix/2, stop=npix/2 - 1, num=npix)*dst)**2 - ls = np.broadcast_to(dc, (dc.shape[0],)*2) - theta = np.sqrt(ls + ls.T) - n = np.cos(theta) - wscreen = np.exp(2*np.pi*1j*w*(n - 1))/n - return wscreen - - -def time_op(func, x, ntries=5): - t0 = time() - for ii in range(ntries): - print(ii) - func(x) - return (time() - t0)/ntries - - -if __name__ == '__main__': - ng.set_nthreads(4) - ntries = 20 - nx = 2048 - dx = 12 - w = 1000.2 - ny, dy = nx, dx - conf = ng.GridderConfig(nx, ny, 1e-7, dx, dy) - x, y = conf.Nxdirty(), conf.Nydirty() - - fld = np.random.randn(x, y) + 1j*np.random.randn(x, y) - func0 = lambda x: _wscreen(nx, dy, w).conjugate()*x - func1 = lambda x: conf.apply_wscreen(x, w, True) - print(time_op(func0, fld), time_op(func1, fld)) - - fld = np.random.randn(nx, ny) - func0 = lambda x: _wscreen(nx, dx, w)*x.real - func1 = lambda x: conf.apply_wscreen(x, w, False) - print(time_op(func0, fld), time_op(func1, fld))