From b5634105054055208f9a9d2d1424bde9637bdbec Mon Sep 17 00:00:00 2001 From: Jonas Adler Date: Tue, 1 Aug 2017 14:07:46 +0200 Subject: [PATCH] MAINT: Bug fixes for product space --- odl/test/operator/tensor_ops_test.py | 20 ++++++++------------ odl/test/space/pspace_test.py | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/odl/test/operator/tensor_ops_test.py b/odl/test/operator/tensor_ops_test.py index 478cacf12b1..15fd250eb7b 100644 --- a/odl/test/operator/tensor_ops_test.py +++ b/odl/test/operator/tensor_ops_test.py @@ -355,12 +355,11 @@ def test_pointwise_inner_adjoint(): testfunc = fspace.element(testarr) testfunc_pwinner_adj = pwinner.adjoint(testfunc) - assert all_almost_equal(testfunc_pwinner_adj, - true_inner_adj.reshape([1, -1])) + assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj) out = vfspace.element() pwinner.adjoint(testfunc, out=out) - assert all_almost_equal(out, true_inner_adj.reshape([1, -1])) + assert all_almost_equal(out, true_inner_adj) # 3d fspace = odl.uniform_discr([0, 0], [1, 1], (2, 2), dtype=complex) @@ -380,12 +379,11 @@ def test_pointwise_inner_adjoint(): testfunc = fspace.element(testarr) testfunc_pwinner_adj = pwinner.adjoint(testfunc) - assert all_almost_equal(testfunc_pwinner_adj, - true_inner_adj.reshape([3, -1])) + assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj) out = vfspace.element() pwinner.adjoint(testfunc, out=out) - assert all_almost_equal(out, true_inner_adj.reshape([3, -1])) + assert all_almost_equal(out, true_inner_adj) def test_pointwise_inner_adjoint_weighted(): @@ -407,12 +405,11 @@ def test_pointwise_inner_adjoint_weighted(): testfunc = fspace.element(testarr) testfunc_pwinner_adj = pwinner.adjoint(testfunc) - assert all_almost_equal(testfunc_pwinner_adj, - true_inner_adj.reshape([3, -1])) + assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj) out = vfspace.element() pwinner.adjoint(testfunc, out=out) - assert all_almost_equal(out, true_inner_adj.reshape([3, -1])) + assert all_almost_equal(out, true_inner_adj) # Using different weighting in the inner product pwinner = PointwiseInner(vfspace, vecfield=array, weighting=[4, 8, 12]) @@ -424,12 +421,11 @@ def test_pointwise_inner_adjoint_weighted(): testfunc = fspace.element(testarr) testfunc_pwinner_adj = pwinner.adjoint(testfunc) - assert all_almost_equal(testfunc_pwinner_adj, - true_inner_adj.reshape([3, -1])) + assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj) out = vfspace.element() pwinner.adjoint(testfunc, out=out) - assert all_almost_equal(out, true_inner_adj.reshape([3, -1])) + assert all_almost_equal(out, true_inner_adj) # ---- PointwiseSum ---- diff --git a/odl/test/space/pspace_test.py b/odl/test/space/pspace_test.py index c4b4e85cb41..bda68e6665c 100644 --- a/odl/test/space/pspace_test.py +++ b/odl/test/space/pspace_test.py @@ -38,7 +38,7 @@ def test_RxR(): # Check the basic properties assert len(HxH) == 2 - assert HxH.shape == (2,) + assert HxH.shape == (2, 2) assert HxH.size == 2 assert HxH.dtype == H.dtype assert HxH.spaces[0] is H