Commit 895884f3 authored by Rouven Lemmerz's avatar Rouven Lemmerz

changed init testing

parent d1a1d8f4
......@@ -18,7 +18,7 @@
from ..multi_domain import MultiDomain
from ..multi_field import MultiField
from .endomorphic_operator import EndomorphicOperator
from .linear_operator import LinearOperator
class BlockDiagonalOperator(EndomorphicOperator):
"""
......@@ -38,7 +38,13 @@ class BlockDiagonalOperator(EndomorphicOperator):
self._capability = self._all_ops
for op in self._ops:
if op is not None:
self._capability &= op.capability
if isinstance(op, LinearOperator):
if op.target is not op.domain:
raise TypeError("domain and target mismatch")
self._capability &= op.capability
else:
raise TypeError("LinearOperator expected")
def apply(self, x, mode):
self._check_input(x, mode)
......
......@@ -263,7 +263,7 @@ def _unpickleSHTOperator(*args):
return SHTOperator(*args)
class HarmonicTransformOperator(LinearOperator):
def HarmonicTransformOperator(domain, target=None, space=None):
"""Transforms between a harmonic domain and a position domain counterpart.
Built-in domain pairs are
......@@ -271,7 +271,8 @@ class HarmonicTransformOperator(LinearOperator):
- an LMSpace and a HPSpace
- an LMSpace and a GLSpace
The supported operations are times() and adjoint_times().
The supported operations are times() and adjoint_times() for LMSpaces
and all for RGSpaces.
Parameters
----------
......@@ -287,7 +288,7 @@ class HarmonicTransformOperator(LinearOperator):
space : int, optional
The index of the domain on which the operator should act
If None, it is set to 0 if domain contains exactly one subdomain.
domain[space] must be a harmonic domain.
domain[space] must be a harmonic domain on the sphere or an RGSpace.
Notes
-----
......@@ -296,26 +297,14 @@ class HarmonicTransformOperator(LinearOperator):
field values are real in either space. If you require a true Fourier
transform you should use FFTOperator instead.
"""
domain = DomainTuple.make(domain)
space = utilities.infer_space(domain, space)
hspc = domain[space]
if isinstance(hspc, RGSpace):
return HartleyOperator(domain, target, space)
else:
return SHTOperator(domain, target, space)
def __init__(self, domain, target=None, space=None):
domain = DomainTuple.make(domain)
space = utilities.infer_space(domain, space)
hspc = domain[space]
if not hspc.harmonic:
raise TypeError(
"HarmonicTransformOperator only works on a harmonic space")
if isinstance(hspc, RGSpace):
self._op = HartleyOperator(domain, target, space)
else:
self._op = SHTOperator(domain, target, space)
self._domain = self._op.domain
self._target = self._op.target
self._capability = self.TIMES | self.ADJOINT_TIMES
def apply(self, x, mode):
self._check_input(x, mode)
return self._op.apply(x, mode)
def HarmonicSmoothingOperator(domain, sigma, space=None):
......
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