def test_compat_Interp(backend, X, Y, Z, RO, PS, K, n, width):
pymr = pytest.importorskip('pymr')
b = backend()
N = (X, Y, Z, K)
M = (1, RO, PS, K)
T = (3, RO, PS)
import scipy.signal as signal
beta = 0.1234
kb = signal.kaiser(2 * n + 1, beta)[n:]
x = indigo.util.rand64c(*N)
traj = indigo.util.rand64c(*T).real - 0.5
G0 = pymr.linop.Interp(M, N, traj, width, kb, dtype=x.dtype)
y_exp = G0 * pymr.util.vec(x)
G1 = b.Interp(N[:3], traj, width, kb, dtype=x.dtype)
y_act = G1 * x.reshape((-1,K), order='F')
y_act = y_act.flatten(order='F')
npt.assert_allclose( y_act, y_exp, rtol=1e-2)
评论列表
文章目录