diff --git a/nifty/spaces/gl_space/gl_space.py b/nifty/spaces/gl_space.py similarity index 99% rename from nifty/spaces/gl_space/gl_space.py rename to nifty/spaces/gl_space.py index 619764e8ec98f3bdb4e1b5e71c4d996982067ab3..a40354506f9e2050df7158319714acc8f1abef5c 100644 --- a/nifty/spaces/gl_space/gl_space.py +++ b/nifty/spaces/gl_space.py @@ -18,7 +18,7 @@ from __future__ import division import numpy as np -from ..space import Space +from .space import Space class GLSpace(Space): diff --git a/nifty/spaces/gl_space/__init__.py b/nifty/spaces/gl_space/__init__.py deleted file mode 100644 index da4756ccc56229189e0550f70a99d21f779e7a7a..0000000000000000000000000000000000000000 --- a/nifty/spaces/gl_space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .gl_space import GLSpace diff --git a/nifty/spaces/hp_space/hp_space.py b/nifty/spaces/hp_space.py similarity index 99% rename from nifty/spaces/hp_space/hp_space.py rename to nifty/spaces/hp_space.py index 261c1ad1c9f28d9aa61cf3e6014cf715b0ef4b0e..528207e60648c86859a1320ad1ded890281563d7 100644 --- a/nifty/spaces/hp_space/hp_space.py +++ b/nifty/spaces/hp_space.py @@ -18,8 +18,7 @@ from __future__ import division import numpy as np - -from ..space import Space +from .space import Space class HPSpace(Space): diff --git a/nifty/spaces/hp_space/__init__.py b/nifty/spaces/hp_space/__init__.py deleted file mode 100644 index 6854432141e63d4d3b4e80c009358a5d8c758d17..0000000000000000000000000000000000000000 --- a/nifty/spaces/hp_space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .hp_space import HPSpace diff --git a/nifty/spaces/lm_space/lm_space.py b/nifty/spaces/lm_space.py similarity index 99% rename from nifty/spaces/lm_space/lm_space.py rename to nifty/spaces/lm_space.py index b04ecb04e80aa49bb5c8331ad1459f4ca5155792..c38e67a68f445478acaa246a13e4207efcb6eea3 100644 --- a/nifty/spaces/lm_space/lm_space.py +++ b/nifty/spaces/lm_space.py @@ -17,10 +17,8 @@ # and financially supported by the Studienstiftung des deutschen Volkes. from __future__ import division - import numpy as np - -from ..space import Space +from .space import Space class LMSpace(Space): diff --git a/nifty/spaces/lm_space/__init__.py b/nifty/spaces/lm_space/__init__.py deleted file mode 100644 index 2c663e5b93143114df194efed410bd1d023d1b70..0000000000000000000000000000000000000000 --- a/nifty/spaces/lm_space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .lm_space import LMSpace diff --git a/nifty/spaces/power_space/power_space.py b/nifty/spaces/power_space.py similarity index 94% rename from nifty/spaces/power_space/power_space.py rename to nifty/spaces/power_space.py index e5eb327032600df27b16a36d60a8a4a80a9af744..4698027d601a9bb22d31e94e82a92c0914380891 100644 --- a/nifty/spaces/power_space/power_space.py +++ b/nifty/spaces/power_space.py @@ -17,10 +17,9 @@ # and financially supported by the Studienstiftung des deutschen Volkes. import numpy as np - -from ...spaces.space import Space +from .space import Space from functools import reduce -from ... import dobj +from .. import dobj class PowerSpace(Space): @@ -51,9 +50,6 @@ class PowerSpace(Space): mapped to which power bin k_lengths : numpy.ndarray Sorted array of all k-modes. - rho : numpy.ndarray - The amount of k-modes that get mapped to one power bin is given by - rho. dim : np.int Total number of dimensionality, i.e. the number of pixels. harmonic : bool @@ -148,7 +144,11 @@ class PowerSpace(Space): if not (isinstance(harmonic_partner, Space) and harmonic_partner.harmonic): raise ValueError("harmonic_partner must be a harmonic space.") + if harmonic_partner.scalar_dvol() is None: + raise ValueError("harmonic partner must have " + "scalar volume factors") self._harmonic_partner = harmonic_partner + pdvol = harmonic_partner.scalar_dvol() if binbounds is not None: binbounds = tuple(binbounds) @@ -165,12 +165,13 @@ class PowerSpace(Space): temp_k_lengths = np.bincount(temp_pindex.ravel(), weights=k_length_array.ravel()) \ / temp_rho + temp_dvol = temp_rho*pdvol self._powerIndexCache[key] = (binbounds, temp_pindex, temp_k_lengths, - temp_rho) + temp_dvol) - (self._binbounds, self._pindex, self._k_lengths, self._rho) = \ + (self._binbounds, self._pindex, self._k_lengths, self._dvol) = \ self._powerIndexCache[key] @staticmethod @@ -199,7 +200,10 @@ class PowerSpace(Space): return self.shape[0] def scalar_dvol(self): - return 1. + return None + + def dvol(self): + return self._dvol def get_k_length_array(self): return self.k_lengths.copy() @@ -232,9 +236,3 @@ class PowerSpace(Space): """ Sorted array of all k-modes. """ return self._k_lengths - - @property - def rho(self): - """Degeneracy factor of the individual k-vectors. - """ - return self._rho diff --git a/nifty/spaces/power_space/__init__.py b/nifty/spaces/power_space/__init__.py deleted file mode 100644 index 36c265fcfa9ad642f552148a589e7eb5bd440568..0000000000000000000000000000000000000000 --- a/nifty/spaces/power_space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .power_space import PowerSpace diff --git a/nifty/spaces/rg_space/rg_space.py b/nifty/spaces/rg_space.py similarity index 99% rename from nifty/spaces/rg_space/rg_space.py rename to nifty/spaces/rg_space.py index 39463fcd6a810097915d85b6ecfc9da657d15c65..8b921bcead9942c3b38a4ce09efe9ea1979efa99 100644 --- a/nifty/spaces/rg_space/rg_space.py +++ b/nifty/spaces/rg_space.py @@ -32,7 +32,7 @@ from __future__ import division from builtins import range from functools import reduce import numpy as np -from ..space import Space +from .space import Space class RGSpace(Space): diff --git a/nifty/spaces/rg_space/__init__.py b/nifty/spaces/rg_space/__init__.py deleted file mode 100644 index 3a82b483002ccad6b1c68646ff3933911c4774b7..0000000000000000000000000000000000000000 --- a/nifty/spaces/rg_space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .rg_space import RGSpace diff --git a/nifty/spaces/space/space.py b/nifty/spaces/space.py similarity index 98% rename from nifty/spaces/space/space.py rename to nifty/spaces/space.py index b37127af2bc6bc2c8c8d84b9c974e657cd7f67c8..025ebc326a90a91b74ff2ab6f273e9749d3982b5 100644 --- a/nifty/spaces/space/space.py +++ b/nifty/spaces/space.py @@ -18,7 +18,7 @@ import abc -from ...domain_object import DomainObject +from ..domain_object import DomainObject class Space(DomainObject): diff --git a/nifty/spaces/space/__init__.py b/nifty/spaces/space/__init__.py deleted file mode 100644 index 6ce7924251cfadfc1414004dfdbd77108a06036b..0000000000000000000000000000000000000000 --- a/nifty/spaces/space/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Copyright(C) 2013-2017 Max-Planck-Society -# -# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik -# and financially supported by the Studienstiftung des deutschen Volkes. - -from .space import Space