Commit 866b4ab0 authored by Philipp Arras's avatar Philipp Arras
Browse files

Merge branch 'NIFTy_4' into PlottingWithUnits

parents f44986c7 e4e5039f
...@@ -111,7 +111,6 @@ class DomainObject(with_metaclass( ...@@ -111,7 +111,6 @@ class DomainObject(with_metaclass(
""" """
return self.scalar_dvol() return self.scalar_dvol()
def total_volume(self): def total_volume(self):
tmp = self.dvol() tmp = self.dvol()
return self.dim * tmp if np.isscalar(tmp) else np.sum(tmp) return self.dim * tmp if np.isscalar(tmp) else np.sum(tmp)
...@@ -151,14 +151,23 @@ class FFTOperatorTests(unittest.TestCase): ...@@ -151,14 +151,23 @@ class FFTOperatorTests(unittest.TestCase):
assert_allclose(v1, v2, rtol=tol, atol=tol) assert_allclose(v1, v2, rtol=tol, atol=tol)
@expand(product([ift.RGSpace(128, distances=3.76, harmonic=True), @expand(product([ift.RGSpace(128, distances=3.76, harmonic=True),
ift.RGSpace((15,27), distances=(1.7,3.33), harmonic=True),
ift.RGSpace(73, distances=0.5643), ift.RGSpace(73, distances=0.5643),
ift.LMSpace(lmax=30, mmax=25)], ift.LMSpace(lmax=30, mmax=25)],
[np.float64, np.float32, np.complex64, np.complex128])) [np.float64, np.float32, np.complex64, np.complex128]))
def test_normalisation(self, space, tp): def test_normalisation(self, space, tp):
tol = 10 * _get_rtol(tp) tol = 10 * _get_rtol(tp)
fft = ift.FFTOperator(space) cospace = space.get_default_codomain()
fft = ift.FFTOperator(space, cospace)
inp = ift.Field.from_random(domain=space, random_type='normal', inp = ift.Field.from_random(domain=space, random_type='normal',
std=1, mean=2, dtype=tp) std=1, mean=2, dtype=tp)
out = fft.times(inp) out = fft.times(inp)
assert_allclose(ift.dobj.to_global_data(inp.val)[0], out.integrate(), fft2 = ift.FFTOperator(cospace, space)
out2 = fft2.inverse_times(inp)
zero_idx = tuple([0]*len(space.shape))
rtol=tol, atol=tol)
rtol=tol, atol=tol) rtol=tol, atol=tol)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment