diff --git a/test_holo_support.py b/test_holo_support.py index 342708165451e5d3cd5038e755bae62478433ee0..803ecf4aae71b56c3fd154bb78ba57e842f40664 100644 --- a/test_holo_support.py +++ b/test_holo_support.py @@ -5,8 +5,8 @@ def test_apply_holo_support(npix, cell, epsilon): np.random.seed(420) # place uv-coverage at inner half of cell centers # the outer half will never be populated if sampling at the Nyquist rate - u = np.fft.fftshift(np.fft.fftfreq(2*npix, d=cell))[npix//2:-npix//2] - umax = u.max() + u = np.fft.fftshift(np.fft.fftfreq(2*npix, d=cell))[npix//2:-npix//2+1] + umax = np.abs(u).max() uu, vv = np.meshgrid(u, u) nrow = uu.size uvw = np.vstack((uu.flatten(), vv.flatten(), np.zeros(nrow))).T @@ -19,7 +19,9 @@ def test_apply_holo_support(npix, cell, epsilon): bl = ng.Baselines(coord=uvw, freq=freq) flags = np.zeros((nrow, 1), dtype=np.bool) idx = ng.getIndices(bl, conf, flags) - print('Support of gridder = ', conf.W()) + W = conf.W() + print('Support of gridder = ', W) + print('Theoretical maximum non-zero diagonals (2*W - 1)**2 = ', (2*W-1)**2) # get explicit holo Ntot = 4 * npix**2 @@ -32,6 +34,14 @@ def test_apply_holo_support(npix, cell, epsilon): # indicator holo_ind = np.where(holo > 0.0, 1.0, 0.0) + # check number of non-zero diagonals + num_diags = 0 + for i in range(-(Ntot//2), Ntot//2+1): + tmp = np.trace(holo_ind, i) + if tmp: + num_diags += 1 + print("Original holo has %i non-zero diagonals"%num_diags) + import matplotlib.pyplot as plt plt.figure('H1') @@ -54,9 +64,17 @@ def test_apply_holo_support(npix, cell, epsilon): # indicator holo_ind2 = np.where(holo2 > 0.0, 1.0, 0.0) + num_diags2 = 0 + for i in range(-(Ntot//2), Ntot//2+1): + tmp = np.trace(holo_ind2, i) + if tmp: + num_diags2 += 1 + print("Perturbed holo has %i non-zero diagonals"%num_diags2) + + import matplotlib.pyplot as plt plt.figure('H2') plt.imshow(np.fft.fftshift(holo_ind2)) plt.show() -test_apply_holo_support(16, 1e-2, 1e-3) \ No newline at end of file +test_apply_holo_support(8, 1e-2, 1e-3) \ No newline at end of file