def test_Symmetrize3D(par): """Dot-test, forward and adjoint for Symmetrize operator on 3d signal""" np.random.seed(10) x = {} x["0"] = np.outer(np.arange(par["ny"]), np.ones( par["nx"]))[:, :, np.newaxis] * np.ones(par["nx"]) + par["imag"] * np.outer( np.arange(par["ny"]), np.ones( par["nx"]))[:, :, np.newaxis] * np.ones(par["nx"]) x["1"] = np.outer(np.ones(par["ny"]), np.arange( par["nx"]))[:, :, np.newaxis] * np.ones(par["nx"]) + par["imag"] * np.outer( np.ones(par["ny"]), np.arange( par["nx"]))[:, :, np.newaxis] * np.ones(par["nx"]) x["2"] = np.outer(np.ones(par["ny"]), np.ones( par["nx"]))[:, :, np.newaxis] * np.arange( par["nx"]) + par["imag"] * np.outer(np.ones( par["ny"]), np.ones(par["nx"]))[:, :, np.newaxis] * np.arange( par["nx"]) for dir in [0, 1, 2]: Sop = Symmetrize( par["ny"] * par["nx"] * par["nx"], dims=(par["ny"], par["nx"], par["nx"]), dir=dir, dtype=par["dtype"], ) y = Sop * x[str(dir)].ravel() assert dottest(Sop, y.size, par["ny"] * par["nx"] * par["nx"]) xinv = Sop / y assert_array_almost_equal(x[str(dir)].ravel(), xinv, decimal=3)
def test_Symmetrize3D(par): """Dot-test, forward and adjoint for Symmetrize operator on 3d signal """ np.random.seed(10) x = {} x['0'] = np.outer(np.arange(par['ny']), np.ones(par['nx']))[:, :, np.newaxis] * \ np.ones(par['nx']) + \ par['imag'] * np.outer(np.arange(par['ny']), np.ones(par['nx']))[:, :, np.newaxis] * \ np.ones(par['nx']) x['1'] = np.outer(np.ones(par['ny']), np.arange(par['nx']))[:, :, np.newaxis] * \ np.ones(par['nx']) + \ par['imag'] * np.outer(np.ones(par['ny']), np.arange(par['nx']))[:, :, np.newaxis] * \ np.ones(par['nx']) x['2'] = np.outer(np.ones(par['ny']), np.ones(par['nx']))[:, :, np.newaxis] * \ np.arange(par['nx']) + \ par['imag'] * np.outer(np.ones(par['ny']), np.ones(par['nx']))[:, :, np.newaxis] * \ np.arange(par['nx']) for dir in [0, 1, 2]: Sop = Symmetrize(par['ny']*par['nx']*par['nx'], dims=(par['ny'], par['nx'], par['nx']), dir=dir, dtype=par['dtype']) y = Sop * x[str(dir)].flatten() assert dottest(Sop, y.size, par['ny']*par['nx']*par['nx']) xinv = Sop / y assert_array_almost_equal(x[str(dir)].ravel(), xinv, decimal=3)
def test_Symmetrize1D(par): """Dot-test, forward and inverse for Symmetrize operator on 1d signal""" np.random.seed(10) x = np.arange(par["ny"]) + par["imag"] * np.arange(par["ny"]) Sop = Symmetrize(par["ny"], dtype=par["dtype"]) dottest(Sop, par["ny"] * 2 - 1, par["ny"], verb=True) y = Sop * x xinv = Sop / y assert_array_almost_equal(x, xinv, decimal=3)