diff --git a/tests/test_polproducts.py b/tests/test_polproducts.py index e3d32ccf..4e2c508c 100644 --- a/tests/test_polproducts.py +++ b/tests/test_polproducts.py @@ -27,8 +27,9 @@ def test_polproducts(do_gains, ms_name): from daskms import xds_from_ms, xds_from_table, xds_to_table from daskms.experimental.zarr import xds_to_zarr from africanus.constants import c as lightspeed - from ducc0.wgridder import dirty2vis + from ducc0.wgridder.experimental import dirty2vis from pfb.utils.naming import xds_from_url + from pfb.operators.gridder import wgridder_conventions test_dir = Path(ms_name).resolve().parent @@ -72,6 +73,8 @@ def test_polproducts(do_gains, ms_name): nx = npix ny = npix + flip_u, flip_v, flip_w, x0, y0 = wgridder_conventions(0.0, 0.0) + print("Image size set to (%i, %i, %i)" % (nchan, nx, ny)) # first axis is Stokes @@ -97,6 +100,11 @@ def test_polproducts(do_gains, ms_name): dirty=model[0, c], pixsize_x=cell_rad, pixsize_y=cell_rad, + center_x=x0, + center_y=y0, + flip_u=flip_u, + flip_v=flip_v, + flip_w=flip_w, epsilon=epsilon, do_wgridding=True, nthreads=8) @@ -107,6 +115,11 @@ def test_polproducts(do_gains, ms_name): dirty=model[1, c], pixsize_x=cell_rad, pixsize_y=cell_rad, + center_x=x0, + center_y=y0, + flip_u=flip_u, + flip_v=flip_v, + flip_w=flip_w, epsilon=epsilon, do_wgridding=True, nthreads=8) @@ -117,6 +130,11 @@ def test_polproducts(do_gains, ms_name): dirty=model[2, c], pixsize_x=cell_rad, pixsize_y=cell_rad, + center_x=x0, + center_y=y0, + flip_u=flip_u, + flip_v=flip_v, + flip_w=flip_w, epsilon=epsilon, do_wgridding=True, nthreads=8) @@ -127,6 +145,11 @@ def test_polproducts(do_gains, ms_name): dirty=model[3, c], pixsize_x=cell_rad, pixsize_y=cell_rad, + center_x=x0, + center_y=y0, + flip_u=flip_u, + flip_v=flip_v, + flip_w=flip_w, epsilon=epsilon, do_wgridding=True, nthreads=8) diff --git a/tests/test_weighting.py b/tests/test_weighting.py index f5525e19..f879a89a 100644 --- a/tests/test_weighting.py +++ b/tests/test_weighting.py @@ -1,6 +1,7 @@ import pytest from pathlib import Path from pfb.utils.weighting import _compute_counts +from pfb.operators.gridder import wgridder_conventions pmp = pytest.mark.parametrize @@ -57,12 +58,14 @@ def test_counts(ms_name): ny = npix print("Image size set to (%i, %i, %i)" % (nchan, nx, ny)) - - + flip_u, flip_v, flip_w, x0, y0 = wgridder_conventions(0.0, 0.0) + usign = 1.0 if not flip_u else -1.0 + vsign = 1.0 if not flip_v else -1.0 mask = np.ones((nrow, nchan), dtype=bool) wgt = np.ones((nrow, nchan), dtype=uvw.dtype) counts = _compute_counts(uvw, freq, mask, wgt, nx, ny, cell_rad, cell_rad, - dtype=np.float64, k=0, ngrid=2) + dtype=np.float64, k=0, ngrid=2, + usign=usign, vsign=vsign) ku = np.sort(np.fft.fftfreq(nx, cell_rad)) # shift by half a pixel to get bin edges kucell = ku[1] - ku[0] @@ -74,8 +77,8 @@ def test_counts(ms_name): kv -= kvcell/2 kv = np.append(kv, kv.max() + kvcell) weights = np.ones((nrow*nchan), dtype=np.float64) - u = (uvw[:, 0:1] * freq[None, :]/lightspeed).ravel() - v = (uvw[:, 1:2] * freq[None, :]/lightspeed).ravel() + u = (usign*uvw[:, 0:1] * freq[None, :]/lightspeed).ravel() + v = (vsign*uvw[:, 1:2] * freq[None, :]/lightspeed).ravel() counts2, _, _ = np.histogram2d(u, v, bins=[ku, kv], weights=weights) assert_allclose(counts, counts2)