Commit 7c883532 authored by Martin Reinecke's avatar Martin Reinecke

demo implementation

parent 19a7c1ed
......@@ -74,11 +74,9 @@ class LogRGSpace(StructuredDomain):
% (self.shape, self.harmonic))
def get_default_codomain(self):
if self._harmonic:
raise ValueError("only supported for nonharmonic space")
codomain_bindistances = 1. / (self.bindistances * self.shape)
return LogRGSpace(self.shape, codomain_bindistances,
np.zeros(len(self.shape)), True)
self._t_0, True)
def get_k_length_array(self):
ib = dobj.ibegin_from_shape(self._shape)
......@@ -65,9 +65,9 @@ def make_amplitude_model(s_space, Npixdof, ceps_a, ceps_k, sm, sv, im, iv,
p_space = PowerSpace(h_space)
exp_transform = ExpTransform(p_space, Npixdof)
logk_space = exp_transform.domain[0]
dof_space = logk_space.get_default_codomain()
qht = QHTOperator(target=logk_space)
dof_space = qht.domain[0]
param_space = UnstructuredDomain(2)
qht = QHTOperator(dof_space, logk_space)
sym = SymmetrizingOperator(logk_space)
phi_mean = np.array([sm, im])
......@@ -36,34 +36,28 @@ class QHTOperator(LinearOperator):
domain : domain, tuple of domains or DomainTuple
The full input domain
target : domain, tuple of domains or DomainTuple
The full output domain
space : int
The index of the domain on which the operator acts.
domain[space] must be a harmonic LogRGSpace.
target : LogRGSpace
The target codomain of domain[space]
Must be a nonharmonic LogRGSpace.
target[space] must be a nonharmonic LogRGSpace.
def __init__(self, domain, target, space=0):
self._domain = DomainTuple.make(domain)
self._space = infer_space(self._domain, space)
def __init__(self, target, space=0):
self._target = DomainTuple.make(target)
self._space = infer_space(self._target, space)
from import LogRGSpace
if not isinstance(self._domain[self._space], LogRGSpace):
raise ValueError("Domain[space] has to be a LogRGSpace!")
if not isinstance(target, LogRGSpace):
raise ValueError("Target has to be a LogRGSpace!")
if not isinstance(self._target[self._space], LogRGSpace):
raise ValueError("target[space] has to be a LogRGSpace!")
if not self._domain[self._space].harmonic:
if self._target[self._space].harmonic:
raise TypeError(
"QHTOperator only works on a harmonic space")
if target.harmonic:
raise TypeError("Target is not a codomain of domain")
"target[space] must be a nonharmonic space")
self._target = [dom for dom in self._domain]
self._target[self._space] = target
self._target = DomainTuple.make(self._target)
self._domain = [dom for dom in self._target]
self._domain[self._space] = \
self._domain = DomainTuple.make(self._domain)
def domain(self):
......@@ -143,8 +143,6 @@ class Consistency_Tests(unittest.TestCase):
ift.LogRGSpace(17, [3.], [.7])), 1)],
def testQHTOperator(self, args, dtype):
dom = ift.DomainTuple.make(args[0])
tgt = list(dom)
tgt[args[1]] = tgt[args[1]].get_default_codomain()
op = ift.QHTOperator(tgt, dom[args[1]], args[1])
tgt = ift.DomainTuple.make(args[0])
op = ift.QHTOperator(tgt, args[1])
ift.extra.consistency_check(op, dtype, dtype)
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