Commit 7041c114 authored by theos's avatar theos
Browse files

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

Merge branch 'feature/field_multiple_space' of gitlab.mpcdf.mpg.de:ift/NIFTy into feature/field_multiple_space

# Conflicts:
#	nifty/field.py
parents 59edf42b 93b50d6e
......@@ -321,6 +321,7 @@ class Field(object):
raise AttributeError(
"ERROR: Field has a space in `domain` which is neither "
"harmonic nor a PowerSpace.")
pass
# synthesize random fields in harmonic domain using
# np.random.multivariate_normal(mean=[0,0], cov=[[0.5,0],[0,0.5]], size=shape)
......
......@@ -26,8 +26,7 @@ class FFTOperator(LinearOperator):
if target is None:
target = utilities.get_default_codomain(self.domain[0])
self._target = self._parse_domain(
utilities.get_default_codomain(self.domain[0]))
self._target = self._parse_domain(target)
self._forward_transformation = TransformationFactory.create(
self.domain[0], self.target[0]
......@@ -39,8 +38,11 @@ class FFTOperator(LinearOperator):
def _times(self, x, spaces, types):
spaces = utilities.cast_axis_to_tuple(spaces, len(x.domain))
if spaces is None:
axes = None
else:
axes = x.domain_axes[spaces[0]]
new_val = self._forward_transformation.transform(x.val, axes=axes)
if spaces is None:
......@@ -56,6 +58,10 @@ class FFTOperator(LinearOperator):
def _inverse_times(self, x, spaces, types):
spaces = utilities.cast_axis_to_tuple(spaces, len(x.domain))
if spaces is None:
axes = None
else:
axes = x.domain_axes[spaces[0]]
axes = x.domain_axes[spaces[0]]
new_val = self._inverse_transformation.transform(x.val, axes=axes)
......
......@@ -549,10 +549,9 @@ class GFFT(Transform):
"""
def __init__(self, domain, codomain, fft_module):
def __init__(self, domain, codomain, fft_module=None):
if fft_module is None:
# gdi cannot find the required module
raise ImportError("ERROR: GFFT module is not available.")
fft_module = gdi['gfft_dummy']
self.domain = domain
self.codomain = codomain
......@@ -610,15 +609,10 @@ class GFFT(Transform):
in_ax=[],
out_ax=[],
ftmachine='fft' if self.codomain.harmonic else 'ifft',
in_zero_center=map(
bool, self.domain.zerocenter
),
out_zero_center=map(
bool, self.codomain.zerocenter
),
enforce_hermitian_symmetry=bool(
self.codomain.complexity
),
in_zero_center=map(bool, self.domain.zerocenter),
out_zero_center=map(bool, self.codomain.zerocenter),
# enforce_hermitian_symmetry=bool(self.codomain.complexity),
enforce_hermitian_symmetry=False,
W=-1,
alpha=-1,
verbose=False
......
......@@ -125,14 +125,19 @@ class RGRGTransformation(Transformation):
"""
if self._transform.codomain.harmonic:
# correct for forward fft
# correct for forward fft.
# naively one would set power to 0.5 here in order to
# apply effectively a factor of 1/sqrt(N) to the field.
# BUT: the pixel volumes of the domain and codomain are different.
# Hence, in order to produce the same scalar product, power===1.
val = self._transform.domain.weight(val, power=1, axes=axes)
# Perform the transformation
Tval = self._transform.transform(val, axes, **kwargs)
if not self._transform.codomain.harmonic:
# correct for inverse fft
# correct for inverse fft.
# See discussion above.
Tval = self._transform.codomain.weight(Tval, power=-1, axes=axes)
return Tval
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