Commit 72b5fd8a authored by Philipp Arras's avatar Philipp Arras
Browse files

Simplifications

parent a2dd2708
......@@ -363,21 +363,20 @@ def test_holo_from_correlations(nxdirty, nydirty, nchan, nrow, epsilon):
W = conf.W()
mat = np.zeros(2*(gridsize,))
n = gridsize*(2*W-1)**2
row = np.zeros((n,))
col = np.zeros((n,))
data = np.zeros((n,))
foo = np.arange(0, gridsize)
row = np.empty((n,))
col = np.empty((n,))
data = np.empty((n,))
ind = np.arange(0, gridsize)
ycoord0 = ind % ny
xcoord0 = ind-ycoord0
for ii, (du, dv) in enumerate(product(range(-W+1, W), range(-W+1, W))):
ilow = ii*gridsize
ihigh = (ii+1)*gridsize
data[ilow:ihigh] = ng.get_correlations(bl, conf, idx, du=du, dv=dv).ravel()
row[ilow:ihigh] = foo
ycoord = foo % ny
xcoord = foo-ycoord
tmp = (ycoord+dv) % ny + xcoord
ycoord = tmp % ny
xcoord = tmp-ycoord
col[ilow:ihigh] = (xcoord + du*ny) % gridsize + ycoord
row[ilow:ihigh] = ind
foo = (ycoord0+dv) % ny + xcoord0
yy = foo % ny
col[ilow:ihigh] = (foo-yy+du*ny) % gridsize + yy
mat = coo_matrix((data, (row, col)), shape=(gridsize, gridsize))
res2 = mat.dot(grid.ravel()).reshape(nx, ny)
assert_allclose(res1, res2)
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