From 1d0e22b70252308c5a39381b6b5b443fa006fa3d Mon Sep 17 00:00:00 2001
From: Martin Reinecke <martin@mpa-garching.mpg.de>
Date: Tue, 19 Sep 2017 16:49:33 +0200
Subject: [PATCH] minor tweaks

---
 nifty2go/field.py                             |  6 +++---
 nifty2go/nifty_utilities.py                   |  2 +-
 .../fft_operator/fft_operator_support.py      | 21 +++++++++++--------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/nifty2go/field.py b/nifty2go/field.py
index e11352c22..cd118618a 100644
--- a/nifty2go/field.py
+++ b/nifty2go/field.py
@@ -16,7 +16,7 @@
 # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
 # and financially supported by the Studienstiftung des deutschen Volkes.
 
-from __future__ import division
+from __future__ import division, print_function
 from builtins import range
 import numpy as np
 from .spaces.power_space import PowerSpace
@@ -195,8 +195,8 @@ class Field(object):
         # power_space instances
         for sp in self.domain:
             if not sp.harmonic and not isinstance(sp, PowerSpace):
-                raise TypeError("Field has a space in `domain` which is "
-                                "neither harmonic nor a PowerSpace.")
+                print("WARNING: Field has a space in `domain` which is "
+                      "neither harmonic nor a PowerSpace.")
 
         # check if the `spaces` input is valid
         if spaces is None:
diff --git a/nifty2go/nifty_utilities.py b/nifty2go/nifty_utilities.py
index b072de5d1..0b4d5dfce 100644
--- a/nifty2go/nifty_utilities.py
+++ b/nifty2go/nifty_utilities.py
@@ -48,7 +48,7 @@ def get_slice_list(shape, axes):
         If axes(axis) does not match shape.
     """
 
-    if not shape:
+    if shape is None:
         raise ValueError("shape cannot be None.")
 
     if axes:
diff --git a/nifty2go/operators/fft_operator/fft_operator_support.py b/nifty2go/operators/fft_operator/fft_operator_support.py
index da734c26e..d64f55d84 100644
--- a/nifty2go/operators/fft_operator/fft_operator_support.py
+++ b/nifty2go/operators/fft_operator/fft_operator_support.py
@@ -60,6 +60,17 @@ class RGRGTransformation(Transformation):
             axes2 = axes[:i] + axes[i+1:]
             RGRGTransformation._fill_upper_half(tmp[dim1], res[dim1], axes2)
 
+    @staticmethod
+    def _fill_array(tmp, res, axes):
+        if axes is None:
+            axes = range(a.ndim)
+        lastaxis = axes[-1]
+        ntmplast = tmp.shape[lastaxis]
+        slice1 = [slice(None)]*lastaxis + [slice(0, ntmplast)]
+        np.add(tmp.real, tmp.imag, out=res[slice1])
+        RGRGTransformation._fill_upper_half(tmp, res, axes)
+        return res
+
     @staticmethod
     def _hartley(a, axes=None):
         # Check if the axes provided are valid given the shape
@@ -71,15 +82,7 @@ class RGRGTransformation(Transformation):
         if issubclass(a.dtype.type, np.complexfloating):
             raise TypeError("Hartley tansform requires real-valued arrays.")
         tmp = rfftn(a, axes=axes)
-        res = np.empty_like(a)
-        if axes is None:
-            axes = range(a.ndim)
-        lastaxis = axes[-1]
-        ntmplast = tmp.shape[lastaxis]
-        slice1 = [slice(None)]*lastaxis + [slice(0, ntmplast)]
-        np.add(tmp.real, tmp.imag, out=res[slice1])
-        RGRGTransformation._fill_upper_half(tmp, res, axes)
-        return res
+        return RGRGTransformation._fill_array(tmp, np.empty_like(a), axes)
 
     def transform(self, val, axes=None):
         """
-- 
GitLab