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

Merge branch 'NIFTy_5' into outer_product

parents eb0162e9 b95589ff
......@@ -27,22 +27,25 @@ from ..operators.harmonic_operators import HarmonicTransformOperator
from ..operators.simple_linear_operators import FieldAdapter
def CorrelatedField(s_space, amplitude_model):
def CorrelatedField(s_space, amplitude_model, name='xi'):
Function for construction of correlated fields
s_space : Field domain
amplitude_model : model for correlation structure
s_space : Domain
Field domain
amplitude_model: Operator
model for correlation structure
name : string
MultiField component name
h_space = s_space.get_default_codomain()
ht = HarmonicTransformOperator(h_space, s_space)
p_space =[0]
power_distributor = PowerDistributor(h_space, p_space)
A = power_distributor(amplitude_model)
return ht(A*FieldAdapter(MultiDomain.make({"xi": h_space}), "xi"))
return ht(A*FieldAdapter(MultiDomain.make({name: h_space}), name))
def MfCorrelatedField(s_space_spatial, s_space_energy, amplitude_model_spatial,
......@@ -289,6 +289,10 @@ class SHTOperator(LinearOperator):
def __reduce__(self):
return (_unpickleSHTOperator,
(self._domain, self._target[self._space], self._space))
def apply(self, x, mode):
self._check_input(x, mode)
if utilities.iscomplextype(x.dtype):
......@@ -337,6 +341,10 @@ class SHTOperator(LinearOperator):
return Field(tdom, dobj.ensure_default_distributed(odat))
def _unpickleSHTOperator(*args):
return SHTOperator(*args)
class HarmonicTransformOperator(LinearOperator):
"""Transforms between a harmonic domain and a position domain counterpart.
......@@ -69,6 +69,6 @@ class OperatorAdapter(LinearOperator):
def __repr__(self):
from ..utilities import indent
mode = ["adjoint", "inverse", "adjoint inverse"][self._trafo]
mode = ["adjoint", "inverse", "adjoint inverse"][self._trafo-1]
res = "OperatorAdapter: {}\n".format(mode)
return res + indent(self._op.__repr__())
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