Commit d04febd8 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent 6c8dc290
......@@ -106,16 +106,15 @@ class Field(object):
def _parse_domain(self, domain, val=None):
if domain is None:
if isinstance(val, Field):
domain = val.domain
elif np.isscalar(val):
domain = ()
else:
raise TypeError("could not infer domain from value")
elif isinstance(domain, DomainObject):
domain = (domain,)
elif not isinstance(domain, tuple):
return val.domain
if np.isscalar(val):
return () # empty domain tuple
raise TypeError("could not infer domain from value")
if isinstance(domain, DomainObject):
return (domain,)
if not isinstance(domain, tuple):
domain = tuple(domain)
for d in domain:
if not isinstance(d, DomainObject):
raise TypeError(
......
......@@ -132,17 +132,13 @@ class FFTOperator(LinearOperator):
# identical to the space in the domain of `self`. Otherwise the
# input check of LinearOperator would have failed.
axes = x.domain_axes[0]
else:
axes = x.domain_axes[spaces[0]]
new_val = self._forward_transformation.transform(x.val, axes=axes)
if spaces is None:
result_domain = self.target
else:
axes = x.domain_axes[spaces[0]]
result_domain = list(x.domain)
result_domain[spaces[0]] = self.target[0]
new_val = self._forward_transformation.transform(x.val, axes=axes)
return Field(result_domain, new_val, copy=False)
def _adjoint_times(self, x, spaces):
......@@ -152,17 +148,13 @@ class FFTOperator(LinearOperator):
# identical to the space in the domain of `self`. Otherwise the
# input check of LinearOperator would have failed.
axes = x.domain_axes[0]
else:
axes = x.domain_axes[spaces[0]]
new_val = self._backward_transformation.transform(x.val, axes=axes)
if spaces is None:
result_domain = self.domain
else:
axes = x.domain_axes[spaces[0]]
result_domain = list(x.domain)
result_domain[spaces[0]] = self.domain[0]
new_val = self._backward_transformation.transform(x.val, axes=axes)
return Field(result_domain, new_val, copy=False)
# ---Mandatory properties and methods---
......
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