diff --git a/nifty/spaces/rg_space/rg_space.py b/nifty/spaces/rg_space/rg_space.py index c142a9064bfc3b65b27c363e1db13deaf327572f..20ec92eb4927373576ec682052f0e602896da9ec 100644 --- a/nifty/spaces/rg_space/rg_space.py +++ b/nifty/spaces/rg_space/rg_space.py @@ -121,11 +121,6 @@ class RGSpace(Space): ndlist = tuple(ndlist) fixed_points = [] for index in np.ndindex(ndlist): - for k in range(dimensions): - if self.shape[k] % 2 != 0 and self.zerocenter[k]: - index = list(index) - index[k] = 1 - index = tuple(index) fixed_points += [tuple(index * mid_index)] return fixed_points @@ -142,12 +137,8 @@ class RGSpace(Space): i = axes[k] slice_picker = slice_primitive[:] slice_inverter = slice_primitive[:] - if (not self.zerocenter[k]) or self.shape[k] % 2 == 0: - slice_picker[i] = slice(1, None, None) - slice_inverter[i] = slice(None, 0, -1) - else: - slice_picker[i] = slice(None) - slice_inverter[i] = slice(None, None, -1) + slice_picker[i] = slice(1, None, None) + slice_inverter[i] = slice(None, 0, -1) slice_picker = tuple(slice_picker) slice_inverter = tuple(slice_inverter) diff --git a/test/test_field.py b/test/test_field.py index c0730910eb89b59561af3ebe4771604de1dbd0d2..e4908aa2b6505fa6fbc6875eed21e1c7398457f0 100644 --- a/test/test_field.py +++ b/test/test_field.py @@ -58,14 +58,12 @@ class Test_Interface(unittest.TestCase): class Test_Functionality(unittest.TestCase): @expand(product([True, False], [True, False], - [True, False], [True, False], [(1,), (4,), (5,)], [(1,), (6,), (7,)])) - def test_hermitian_decomposition(self, z1, z2, preserve, complexdata, - s1, s2): + def test_hermitian_decomposition(self, preserve, complexdata, s1, s2): np.random.seed(123) - r1 = RGSpace(s1, harmonic=True, zerocenter=(z1,)) - r2 = RGSpace(s2, harmonic=True, zerocenter=(z2,)) - ra = RGSpace(s1+s2, harmonic=True, zerocenter=(z1, z2)) + r1 = RGSpace(s1, harmonic=True) + r2 = RGSpace(s2, harmonic=True) + ra = RGSpace(s1+s2, harmonic=True) v = np.random.random(s1+s2) if complexdata: @@ -84,12 +82,9 @@ class Test_Functionality(unittest.TestCase): assert_almost_equal(h1.get_full_data(), h3.get_full_data()) assert_almost_equal(a1.get_full_data(), a3.get_full_data()) - @expand(product([RGSpace((8,), harmonic=True, - zerocenter=False), - RGSpace((8, 8), harmonic=True, distances=0.123, - zerocenter=True)], - [RGSpace((8,), harmonic=True, - zerocenter=False), + @expand(product([RGSpace((8,), harmonic=True), + RGSpace((8, 8), harmonic=True, distances=0.123)], + [RGSpace((8,), harmonic=True), LMSpace(12)])) def test_power_synthesize_analyze(self, space1, space2): p1 = PowerSpace(space1) diff --git a/test/test_spaces/test_rg_space.py b/test/test_spaces/test_rg_space.py index cdfd4eacd80a1b0a83eb275e5b10c296107c4701..f70c3a32db40b80a5e8c6a5debc5cec58092bce3 100644 --- a/test/test_spaces/test_rg_space.py +++ b/test/test_spaces/test_rg_space.py @@ -126,10 +126,9 @@ class RGSpaceFunctionalityTests(unittest.TestCase): assert_equal(getattr(x, key), value) @expand(product([(10,), (11,), (1, 1), (4, 4), (5, 7), (8, 12), (7, 16), - (4, 6, 8), (17, 5, 3)], - [True, False])) - def test_hermitian_decomposition(self, shape, zerocenter): - r = RGSpace(shape, harmonic=True, zerocenter=zerocenter) + (4, 6, 8), (17, 5, 3)])) + def test_hermitian_decomposition(self, shape): + r = RGSpace(shape, harmonic=True) v = np.empty(shape, dtype=np.complex128) v.real = np.random.random(shape) v.imag = np.random.random(shape) @@ -147,20 +146,16 @@ class RGSpaceFunctionalityTests(unittest.TestCase): i1 = it.multi_index i2 = [] for i in range(len(i1)): - if r.zerocenter[i] and r.shape[i] % 2 != 0: - i2.append(h.shape[i]-i1[i]-1) - else: - i2.append(h.shape[i]-i1[i] if i1[i] > 0 else 0) + i2.append(h.shape[i]-i1[i] if i1[i] > 0 else 0) i2 = tuple(i2) assert_almost_equal(h[i1], np.conj(h[i2])) assert_almost_equal(a[i1], -np.conj(a[i2])) it.iternext() @expand(product([(10,), (11,), (1, 1), (4, 4), (5, 7), (8, 12), (7, 16), - (4, 6, 8), (17, 5, 3)], - [True, False])) - def test_hermitian_decomposition2(self, shape, zerocenter): - r = RGSpace(shape, harmonic=True, zerocenter=zerocenter) + (4, 6, 8), (17, 5, 3)])) + def test_hermitian_decomposition2(self, shape): + r = RGSpace(shape, harmonic=True) v = np.random.random(shape) h, a = r.hermitian_decomposition(v) # make sure that data == h + a @@ -171,10 +166,7 @@ class RGSpaceFunctionalityTests(unittest.TestCase): i1 = it.multi_index i2 = [] for i in range(len(i1)): - if r.zerocenter[i] and r.shape[i] % 2 != 0: - i2.append(h.shape[i]-i1[i]-1) - else: - i2.append(h.shape[i]-i1[i] if i1[i] > 0 else 0) + i2.append(h.shape[i]-i1[i] if i1[i] > 0 else 0) i2 = tuple(i2) assert_almost_equal(h[i1], np.conj(h[i2])) assert_almost_equal(a[i1], -np.conj(a[i2])) @@ -195,6 +187,6 @@ class RGSpaceFunctionalityTests(unittest.TestCase): assert_(x is res) def test_hermitian_fixed_points(self): - x = RGSpace((5, 6, 5, 6), zerocenter=[False, False, True, True]) + x = RGSpace((5, 6, 5, 6)) assert_equal(x.hermitian_fixed_points(), - [(0, 0, 2, 0), (0, 0, 2, 3), (0, 3, 2, 0), (0, 3, 2, 3)]) + [(0, 0, 0, 0), (0, 0, 0, 3), (0, 3, 0, 0), (0, 3, 0, 3)])