Commit 5221b105 authored by Theo Steininger's avatar Theo Steininger

Merge branch 'master' into versioning

parents b5abf435 6146b0ce
......@@ -28,7 +28,7 @@ def _healpy_validator(use_healpy):
if not isinstance(use_healpy, bool):
return False
if not use_healpy:
return False
return True
if 'healpy' not in dependency_injector:
return False
healpy = dependency_injector['healpy']
......
......@@ -17,7 +17,8 @@ class GLLMTransformation(SlicingTransformation):
raise ImportError(
"The module libsharp is needed but not available.")
super(GLLMTransformation, self).__init__(domain, codomain, module)
super(GLLMTransformation, self).__init__(domain, codomain,
module=module)
# ---Mandatory properties and methods---
......
......@@ -18,7 +18,8 @@ class HPLMTransformation(SlicingTransformation):
raise ImportError(
"The module healpy is needed but not available")
super(HPLMTransformation, self).__init__(domain, codomain, module)
super(HPLMTransformation, self).__init__(domain, codomain,
module=module)
# ---Mandatory properties and methods---
......
import numpy as np
cimport numpy as np
......@@ -30,12 +31,12 @@ cpdef np.ndarray[np.float32_t, ndim=1] _buildIdx_f(np.ndarray[np
cpdef np.ndarray[np.float32_t, ndim=1] _realify_f(np.ndarray[np.complex64_t, ndim=1] nr, np.int_t lmax):
cdef np.ndarray resi=np.zeros([len(nr)], dtype=np.float32)
resi[0:lmax+1] = np.real(nr[0:lmax+1])
resi[0:lmax+1] = nr[0:lmax+1].real
for i in xrange(lmax+1,len(nr),2):
mi = int(np.ceil(((2*lmax+1)-np.sqrt((2*lmax+1)*(2*lmax+1)-4*(i-lmax)+1))/2))
resi[i]=np.sqrt(2)*np.real(nr[i])*(-1)**(mi*mi)
resi[i+1]=np.sqrt(2)*np.imag(nr[i])*(-1)**(mi*mi)
resi[i]=np.sqrt(2)*(nr[i]).real*(-1)**(mi*mi)
resi[i+1]=np.sqrt(2)*(nr[i]).imag*(-1)**(mi*mi)
return resi
cpdef np.ndarray[np.float64_t, ndim=1] _buildIdx(np.ndarray[np.complex128_t,
......@@ -55,12 +56,12 @@ cpdef np.ndarray[np.float64_t, ndim=1] _buildIdx(np.ndarray[np.complex128_t,
cpdef np.ndarray[np.float64_t, ndim=1] _realify(np.ndarray[np.complex128_t, ndim=1] nr, np.int_t lmax):
cdef np.ndarray resi=np.zeros([len(nr)], dtype=np.float64)
resi[0:lmax+1] = np.real(nr[0:lmax+1])
resi[0:lmax+1] = (nr[0:lmax+1]).real
for i in xrange(lmax+1,len(nr),2):
mi = int(np.ceil(((2*lmax+1)-np.sqrt((2*lmax+1)*(2*lmax+1)-4*(i-lmax)+1))/2))
resi[i]=np.sqrt(2)*np.real(nr[i])*(-1)**(mi*mi)
resi[i+1]=np.sqrt(2)*np.imag(nr[i])*(-1)**(mi*mi)
resi[i]=np.sqrt(2)*(nr[i]).real*(-1)**(mi*mi)
resi[i+1]=np.sqrt(2)*(nr[i]).imag*(-1)**(mi*mi)
return resi
cpdef np.ndarray[np.complex64_t, ndim=1] _buildLm_f(np.ndarray[np.float32_t,
......@@ -79,7 +80,7 @@ ndim=1] nr, np.int_t lmax):
cpdef np.ndarray[np.complex64_t, ndim=1] _inverseRealify_f(np.ndarray[np.float32_t, ndim=1] nr, np.int_t lmax):
cdef np.ndarray resi=np.zeros([len(nr)], dtype=np.complex64)
resi[0:lmax+1] = np.real(nr[0:lmax+1])
resi[0:lmax+1] = (nr[0:lmax+1]).real
for i in xrange(lmax+1,len(nr),2):
mi = int(np.ceil(((2*lmax+1)-np.sqrt((2*lmax+1)*(2*lmax+1)-4*(i-lmax)+1))/2))
......@@ -104,7 +105,7 @@ ndim=1] nr, np.int_t lmax):
cpdef np.ndarray[np.complex128_t, ndim=1] _inverseRealify(np.ndarray[np.float64_t, ndim=1] nr, np.int_t lmax):
cdef np.ndarray resi=np.zeros([len(nr)], dtype=np.complex128)
resi[0:lmax+1] = np.real(nr[0:lmax+1])
resi[0:lmax+1] = (nr[0:lmax+1]).real
for i in xrange(lmax+1,len(nr),2):
mi = int(np.ceil(((2*lmax+1)-np.sqrt((2*lmax+1)*(2*lmax+1)-4*(i-lmax)+1))/2))
......
......@@ -17,7 +17,8 @@ class LMGLTransformation(SlicingTransformation):
raise ImportError(
"The module libsharp is needed but not available.")
super(LMGLTransformation, self).__init__(domain, codomain, module)
super(LMGLTransformation, self).__init__(domain, codomain,
module=module)
# ---Mandatory properties and methods---
......
......@@ -16,7 +16,8 @@ class LMHPTransformation(SlicingTransformation):
raise ImportError(
"The module libsharp is needed but not available.")
super(LMHPTransformation, self).__init__(domain, codomain, module)
super(LMHPTransformation, self).__init__(domain, codomain,
module=module)
# ---Mandatory properties and methods---
......
......@@ -7,7 +7,8 @@ from nifty import RGSpace, nifty_configuration
class RGRGTransformation(Transformation):
def __init__(self, domain, codomain=None, module=None):
super(RGRGTransformation, self).__init__(domain, codomain)
super(RGRGTransformation, self).__init__(domain, codomain,
module=module)
if module is None:
if nifty_configuration['fft_module'] == 'pyfftw':
......
......@@ -11,7 +11,7 @@ class Transformation(Loggable, object):
"""
__metaclass__ = abc.ABCMeta
def __init__(self, domain, codomain, module):
def __init__(self, domain, codomain, module=None):
if codomain is None:
self.domain = domain
self.codomain = self.get_codomain(domain)
......
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