Commit 3c771b2f authored by Theo Steininger's avatar Theo Steininger
Browse files

Merge branch 'master' of gitlab.mpcdf.mpg.de:ift/NIFTy

parents 9ee541a0 1c1b6377
Pipeline #17228 passed with stages
in 25 minutes and 7 seconds
......@@ -16,4 +16,4 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from composed_operator import ComposedOperator
from .composed_operator import ComposedOperator
......@@ -16,7 +16,8 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from nifty.operators.linear_operator import LinearOperator
from builtins import range
from ..linear_operator import LinearOperator
class ComposedOperator(LinearOperator):
......@@ -136,7 +137,7 @@ class ComposedOperator(LinearOperator):
def _times_helper(self, x, spaces, func):
space_index = 0
if spaces is None:
spaces = range(len(self.domain))
spaces = list(range(len(self.domain)))
for op in self._operator_store:
active_spaces = spaces[space_index:space_index+len(op.domain)]
space_index += len(op.domain)
......@@ -147,7 +148,7 @@ class ComposedOperator(LinearOperator):
def _inverse_times_helper(self, x, spaces, func):
space_index = 0
if spaces is None:
spaces = range(len(self.target))
spaces = list(range(len(self.target)))
rev_spaces = spaces[::-1]
for op in reversed(self._operator_store):
active_spaces = rev_spaces[space_index:space_index+len(op.target)]
......
......@@ -16,4 +16,4 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from diagonal_operator import DiagonalOperator
from .diagonal_operator import DiagonalOperator
......@@ -16,14 +16,16 @@
# 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 builtins import range
import numpy as np
from d2o import distributed_data_object,\
STRATEGIES as DISTRIBUTION_STRATEGIES
from nifty.config import nifty_configuration as gc
from nifty.field import Field
from nifty.operators.endomorphic_operator import EndomorphicOperator
from ...config import nifty_configuration as gc
from ...field import Field
from ..endomorphic_operator import EndomorphicOperator
class DiagonalOperator(EndomorphicOperator):
......@@ -125,11 +127,11 @@ class DiagonalOperator(EndomorphicOperator):
operation=lambda z: z.adjoint().__mul__)
def _inverse_times(self, x, spaces):
return self._times_helper(x, spaces, operation=lambda z: z.__rdiv__)
return self._times_helper(x, spaces, operation=lambda z: z.__rtruediv__)
def _adjoint_inverse_times(self, x, spaces):
return self._times_helper(x, spaces,
operation=lambda z: z.adjoint().__rdiv__)
operation=lambda z: z.adjoint().__rtruediv__)
def diagonal(self, bare=False, copy=True):
""" Returns the diagonal of the Operator.
......@@ -269,7 +271,7 @@ class DiagonalOperator(EndomorphicOperator):
# the one of x, reshape the local data of self and apply it directly
active_axes = []
if spaces is None:
active_axes = range(len(x.shape))
active_axes = list(range(len(x.shape)))
else:
for space_index in spaces:
active_axes += x.domain_axes[space_index]
......@@ -287,7 +289,7 @@ class DiagonalOperator(EndomorphicOperator):
local_diagonal = redistr_diagonal_val.get_local_data(copy=False)
reshaper = [x.val.data.shape[i] if i in active_axes else 1
for i in xrange(len(x.shape))]
for i in range(len(x.shape))]
reshaped_local_diagonal = np.reshape(local_diagonal, reshaper)
# here the actual multiplication takes place
......
......@@ -16,4 +16,4 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from endomorphic_operator import EndomorphicOperator
from .endomorphic_operator import EndomorphicOperator
......@@ -18,7 +18,7 @@
import abc
from nifty.operators.linear_operator import LinearOperator
from ..linear_operator import LinearOperator
class EndomorphicOperator(LinearOperator):
......
......@@ -16,5 +16,5 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from transformations import *
from .transformations import *
from .fft_operator import FFTOperator
......@@ -18,14 +18,14 @@
import numpy as np
import nifty.nifty_utilities as utilities
from nifty.spaces import RGSpace,\
GLSpace,\
HPSpace,\
LMSpace
from nifty.operators.linear_operator import LinearOperator
from transformations import RGRGTransformation,\
from ... import nifty_utilities as utilities
from ...spaces import RGSpace,\
GLSpace,\
HPSpace,\
LMSpace
from ..linear_operator import LinearOperator
from .transformations import RGRGTransformation,\
LMGLTransformation,\
LMHPTransformation,\
GLLMTransformation,\
......
......@@ -16,10 +16,10 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from rgrgtransformation import RGRGTransformation
from gllmtransformation import GLLMTransformation
from hplmtransformation import HPLMTransformation
from lmgltransformation import LMGLTransformation
from lmhptransformation import LMHPTransformation
from .rgrgtransformation import RGRGTransformation
from .gllmtransformation import GLLMTransformation
from .hplmtransformation import HPLMTransformation
from .lmgltransformation import LMGLTransformation
from .lmhptransformation import LMHPTransformation
from transformation_cache import TransformationCache
\ No newline at end of file
from .transformation_cache import TransformationCache
......@@ -18,10 +18,10 @@
import numpy as np
from nifty.config import dependency_injector as gdi
from nifty import GLSpace, LMSpace
from slicing_transformation import SlicingTransformation
import lm_transformation_helper
from ....config import dependency_injector as gdi
from .... import GLSpace, LMSpace
from .slicing_transformation import SlicingTransformation
from . import lm_transformation_helper
pyHealpix = gdi.get('pyHealpix')
......
......@@ -18,11 +18,11 @@
import numpy as np
from nifty.config import dependency_injector as gdi
from nifty import HPSpace, LMSpace
from slicing_transformation import SlicingTransformation
from ....config import dependency_injector as gdi
from .... import HPSpace, LMSpace
from .slicing_transformation import SlicingTransformation
import lm_transformation_helper
from . import lm_transformation_helper
pyHealpix = gdi.get('pyHealpix')
......
from __future__ import division
import numpy as np
def buildLm(nr, lmax):
new_dtype = np.result_type(nr.dtype, np.complex64)
size = (len(nr)-lmax-1)/2+lmax+1
size = (len(nr)-lmax-1)//2+lmax+1
res = np.zeros([size], dtype=new_dtype)
res[0:lmax+1] = nr[0:lmax+1]
res[lmax+1:] = np.sqrt(0.5)*(nr[lmax+1::2] + 1j*nr[lmax+2::2])
......
......@@ -17,11 +17,11 @@
# and financially supported by the Studienstiftung des deutschen Volkes.
import numpy as np
from nifty.config import dependency_injector as gdi
from nifty import GLSpace, LMSpace
from ....config import dependency_injector as gdi
from .... import GLSpace, LMSpace
from slicing_transformation import SlicingTransformation
import lm_transformation_helper
from .slicing_transformation import SlicingTransformation
from . import lm_transformation_helper
pyHealpix = gdi.get('pyHealpix')
......
......@@ -17,10 +17,10 @@
# and financially supported by the Studienstiftung des deutschen Volkes.
import numpy as np
from nifty.config import dependency_injector as gdi
from nifty import HPSpace, LMSpace
from slicing_transformation import SlicingTransformation
import lm_transformation_helper
from ....config import dependency_injector as gdi
from .... import HPSpace, LMSpace
from .slicing_transformation import SlicingTransformation
from . import lm_transformation_helper
pyHealpix = gdi.get('pyHealpix')
......
......@@ -16,14 +16,17 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from builtins import range
from builtins import object
import warnings
import numpy as np
from d2o import distributed_data_object, STRATEGIES
from nifty.config import dependency_injector as gdi
import nifty.nifty_utilities as utilities
from ....config import dependency_injector as gdi
from .... import nifty_utilities as utilities
from keepers import Loggable
from functools import reduce
fftw = gdi.get('fftw')
......
......@@ -16,10 +16,11 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from __future__ import division
import numpy as np
from transformation import Transformation
from rg_transforms import MPIFFT, SerialFFT
from nifty import RGSpace, nifty_configuration
from .transformation import Transformation
from .rg_transforms import MPIFFT, SerialFFT
from .... import RGSpace, nifty_configuration
class RGRGTransformation(Transformation):
......@@ -84,8 +85,8 @@ class RGRGTransformation(Transformation):
zerocenter = temp
# calculate the initialization parameters
distances = 1 / (np.array(domain.shape) *
np.array(domain.distances))
distances = 1. / (np.array(domain.shape) *
np.array(domain.distances))
new_space = RGSpace(domain.shape,
zerocenter=zerocenter,
......
......@@ -19,8 +19,8 @@
import abc
import numpy as np
import nifty.nifty_utilities as utilities
from transformation import Transformation
from .... import nifty_utilities as utilities
from .transformation import Transformation
class SlicingTransformation(Transformation):
......
......@@ -19,14 +19,14 @@
import abc
from keepers import Loggable
from future.utils import with_metaclass
class Transformation(Loggable, object):
class Transformation(with_metaclass(abc.ABCMeta, type('NewBase', (Loggable, object), {}))):
"""
A generic transformation which defines a static check_codomain
method for all transforms.
"""
__metaclass__ = abc.ABCMeta
def __init__(self, domain, codomain, module=None):
if codomain is None:
......
......@@ -16,6 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from builtins import object
class _TransformationCache(object):
def __init__(self):
......
......@@ -16,4 +16,4 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from invertible_operator_mixin import InvertibleOperatorMixin
\ No newline at end of file
from .invertible_operator_mixin import InvertibleOperatorMixin
Supports Markdown
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