Commit 4f6b914c authored by Martin Reinecke's avatar Martin Reinecke

adjust to gridder changes

parent d4c14850
Pipeline #49013 passed with stages
in 17 minutes and 20 seconds
......@@ -26,7 +26,7 @@ from ..sugar import from_global_data, makeDomain
class GridderMaker(object):
def __init__(self, domain, eps=1e-15):
def __init__(self, domain, eps=2e-13):
from nifty_gridder import get_w
domain = makeDomain(domain)
if (len(domain) != 1 or not isinstance(domain[0], RGSpace) or
......
......@@ -25,11 +25,12 @@ np.random.seed(40)
pmp = pytest.mark.parametrize
def _l2error(a,b):
return np.sqrt(np.sum(np.abs(a-b)**2)/np.sum(np.abs(a)**2))
@pmp('eps', [1e-2, 1e-6, 1e-7, 1e-15])
@pmp('eps', [ 1e-2, 1e-4, 1e-7, 1e-10, 1e-11, 1e-12, 2e-13])
@pmp('nu', [12, 128])
@pmp('nv', [4, 12, 128])
@pmp('N', [1, 10, 100])
......@@ -52,17 +53,17 @@ def test_gridding(nu, nv, N, eps):
dft = pynu*0.
for i in range(N):
dft += (vis[i]*np.exp(2j*np.pi*(x*uv[i, 0] + y*uv[i, 1]))).real
assert(_l2error(dft,pynu)<max(1e-13,10*eps))
assert(_l2error(dft,pynu)<eps)
@pmp('eps', [1e-2, 1e-6, 1e-15])
@pmp('eps', [1e-2, 1e-6, 2e-13])
@pmp('nu', [12, 128])
@pmp('nv', [4, 12, 128])
@pmp('N', [1, 10, 100])
def test_build(nu, nv, N, eps):
dom = ift.RGSpace([nu, nv])
uv = np.random.rand(N, 2) - 0.5
GM = ift.GridderMaker(dom)
GM = ift.GridderMaker(dom, eps=eps)
# re-order for performance
idx = GM.getReordering(uv)
uv = uv[idx]
......
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