def test_compat_NUFFT(backend, X, Y, Z, RO, PS, K, oversamp, n, width):
pymr = pytest.importorskip('pymr')
b = backend()
c_dims = (X, Y, Z, K)
nc_dims = (1, RO, PS, K)
t_dims = (3, RO, PS)
x = indigo.util.rand64c(*c_dims)
traj = indigo.util.rand64c( *t_dims ).real - 0.5
kwargs = dict(oversamp=oversamp, width=width, n=n, dtype=x.dtype)
print(nc_dims, c_dims, traj.shape)
G0 = pymr.linop.NUFFT(nc_dims, c_dims, traj, **kwargs)
G1 = b.NUFFT(nc_dims[:3], c_dims[:3], traj, **kwargs)
x_indigo = np.asfortranarray(x.reshape((-1,K), order='F'))
x_pmr = pymr.util.vec(x)
y_exp = G0 * x_pmr
y_act = G1 * x_indigo
y_act = y_act.reshape(-1, order='F')
npt.assert_allclose(abs(y_act), abs(y_exp), rtol=1e-2)
评论列表
文章目录