Commit f0e80b54 authored by Philipp Arras's avatar Philipp Arras
Browse files

Simplify

parent ddf292bf
......@@ -360,13 +360,9 @@ def test_holo_from_correlations(nxdirty, nydirty, nchan, nrow, epsilon):
bl, conf, idx = _init_gridder(nxdirty, nydirty, epsilon, nchan, nrow)
nx, ny, gridsize = 2*nxdirty, 2*nydirty, 4*nxdirty*nydirty
grid = np.random.randn(nx, ny) + 1.0j*np.random.randn(nx, ny)
res1 = ng.apply_holo(bl, conf, idx, grid)
W = conf.W()
mat = np.zeros(2*(gridsize,))
n = gridsize*(2*W-1)**2
row = np.empty((n,))
col = np.empty((n,))
data = np.empty((n,))
row, col, data = np.empty((n,)), np.empty((n,)), np.empty((n,))
ind = np.arange(0, gridsize)
y0 = ind % ny
x0 = ind - y0
......@@ -377,6 +373,6 @@ def test_holo_from_correlations(nxdirty, nydirty, nchan, nrow, epsilon):
col[slc] = (foo-yy+du*ny) % gridsize + yy
row[slc] = ind
data[slc] = ng.get_correlations(bl, conf, idx, du=du, dv=dv).ravel()
mat = coo_matrix((data, (row, col)), shape=(gridsize, gridsize))
res2 = mat.dot(grid.ravel()).reshape(nx, ny)
assert_allclose(res1, res2)
res0 = coo_matrix((data, (row, col)), shape=2*(gridsize,)).dot(grid.ravel()).reshape(nx, ny)
res1 = ng.apply_holo(bl, conf, idx, grid)
assert_allclose(res0, res1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment