test_compat.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:indigo 作者: mbdriscoll 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号