Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce runtime #226

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions africanus/gridding/perleypolyhedron/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def kbsinc(W, b=None, oversample=5, order=15):
with a modification of higher order bessels as default, as
this improves the kernel at low number of taps.
"""

if b is None:
b = np.poly1d(_KBSINC_AUTOCOEFFS)((W + 2))

Expand All @@ -78,6 +79,7 @@ def hanningsinc(W, a=None, oversample=5):
"""
if a is None:
a = np.poly1d(_HANNING_AUTOCOEFFS)((W + 2))

u = uspace(W, oversample)
wnd = a + (1 - a) * np.cos(2 * np.pi / ((W + 2) + 1) * u)
res = sinc(W, oversample=oversample) * wnd
Expand Down
25 changes: 16 additions & 9 deletions africanus/gridding/perleypolyhedron/tests/test_daskintrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def test_gridder_dask():
W = 5
OS = 9
kern = kernels.pack_kernel(kernels.kbsinc(W, oversample=OS), W, OS)
nrow = int(1e6)
nrow = int(1e3)

np.random.seed(0)
# simulate some ficticious baselines rotated by an hour angle
row_chunks = nrow // 10
Expand All @@ -70,7 +71,8 @@ def test_gridder_dask():
uvw[n * ntime + ih0, :] = np.dot(R, blpos[n, :].T)
uvw = da.from_array(uvw, chunks=(row_chunks, 3))
pxacrossbeam = 5
nchan = 128
nchan = 64

frequency = da.from_array(np.linspace(1.0e9, 1.4e9, nchan),
chunks=(nchan, ))
wavelength = lightspeed / frequency
Expand Down Expand Up @@ -132,7 +134,8 @@ def test_gridder_nondask():
W = 5
OS = 9
kern = kernels.pack_kernel(kernels.kbsinc(W, oversample=OS), W, OS)
nrow = int(1e6)
nrow = int(1e3)

np.random.seed(0)
# simulate some ficticious baselines rotated by an hour angle
uvw = np.zeros((nrow, 3), dtype=np.float64)
Expand All @@ -152,7 +155,7 @@ def test_gridder_nondask():
s(d0)]])
uvw[n * ntime + ih0, :] = np.dot(R, blpos[n, :].T)
pxacrossbeam = 5
nchan = 128
nchan = 64
frequency = np.linspace(1.0e9, 1.4e9, nchan)
wavelength = lightspeed / frequency
cell = np.rad2deg(
Expand Down Expand Up @@ -208,14 +211,15 @@ def test_degrid_dft_packed_nondask():
kern = kernels.pack_kernel(kernels.kbsinc(W, oversample=OS),
W,
oversample=OS)
nrow = int(5e4)
nrow = int(5e3)
uvw = np.column_stack(
(5000.0 * np.cos(np.linspace(0, 2 * np.pi, nrow)),
5000.0 * np.sin(np.linspace(0, 2 * np.pi, nrow)), np.zeros(nrow)))

pxacrossbeam = 10
nchan = 1024
nchan = 64
frequency = np.linspace(1.0e9, 1.4e9, nchan)

wavelength = lightspeed / frequency

cell = np.rad2deg(
Expand Down Expand Up @@ -259,15 +263,16 @@ def test_degrid_dft_packed_dask():
kern = kernels.pack_kernel(kernels.kbsinc(W, oversample=OS),
W,
oversample=OS)
nrow = int(5e4)
nrow = int(5e3)
nrow_chunk = nrow // 32
uvw = np.column_stack(
(5000.0 * np.cos(np.linspace(0, 2 * np.pi, nrow)),
5000.0 * np.sin(np.linspace(0, 2 * np.pi, nrow)), np.zeros(nrow)))

pxacrossbeam = 10
nchan = 1024
nchan = 64
frequency = np.linspace(1.0e9, 1.4e9, nchan)

wavelength = lightspeed / frequency

cell = np.rad2deg(
Expand Down Expand Up @@ -320,8 +325,10 @@ def test_degrid_dft_packed_dask_dft_check():
5000.0 * np.sin(np.linspace(0, 2 * np.pi, nrow)), np.zeros(nrow)))

pxacrossbeam = 10
nchan = 16
nchan = 1

frequency = np.linspace(1.0e9, 1.4e9, nchan)

wavelength = lightspeed / frequency

cell = np.rad2deg(
Expand Down
Loading