Commit 6c9b81c5 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'operator_documentation' into 'NIFTy_5'

Operator documentation

See merge request ift/nifty-dev!31
parents bf680c24 bb694b83
......@@ -94,6 +94,15 @@ class ChainOperator(LinearOperator):
@staticmethod
def make(ops):
"""Build a ChainOperator (or something simpler if possible),
a sequence of concatenated LinearOperators.
Parameters
----------
ops: list of LinearOperator
Individual operators of the chain.
"""
ops = tuple(ops)
if len(ops) == 0:
raise ValueError("ops is empty")
......
......@@ -197,8 +197,8 @@ class LinearOperator(NiftyMetaBase()):
raise NotImplementedError
def __call__(self, x):
from ..models import LinearModel, Model
"""Same as :meth:`times`"""
from ..models import LinearModel, Model
if isinstance(x, Model):
return LinearModel(x, self)
return self.apply(x, self.TIMES)
......
......@@ -21,6 +21,15 @@ from .linear_operator import LinearOperator
class MultiAdaptor(LinearOperator):
"""Transforms a Field into a MultiField and vise versa when
using adjoint_times.
Parameters
----------
target: MultiDomain
MultiDomain with only one entry (key).
"""
def __init__(self, target):
super(MultiAdaptor, self).__init__()
if not isinstance(target, MultiDomain) or len(target) > 1:
......
......@@ -6,6 +6,20 @@ from .linear_operator import LinearOperator
class QHTOperator(LinearOperator):
"""
Does a Hartley transform on LogRGSpace
This operator takes a field on a LogRGSpace and transforms it
according to the Hartley transform. The zero modes are not transformed
because they are infinitely far away.
Parameters
----------
domain : LogRGSpace
The domain needs to be a LogRGSpace.
target : LogRGSpace
The target needs to be a LogRGSpace.
"""
def __init__(self, domain, target):
if not domain.harmonic:
raise TypeError(
......
......@@ -20,6 +20,16 @@ from ..operators import LinearOperator
class SelectionOperator(LinearOperator):
"""Extracts from a MultiField a copy of the Field
living on the subdomain selected by `key`.
Parameters
----------
domain : :class:`MultiDomain`
Domain of the MultiFields to be acted on
key : :class:`str`
String identifier of the wanted subdomain
"""
def __init__(self, domain, key):
from ..multi import MultiDomain
if not isinstance(domain, MultiDomain):
......
......@@ -133,6 +133,16 @@ class SumOperator(LinearOperator):
@staticmethod
def make(ops, neg):
"""Build a SumOperator (or something simpler if possible)
Parameters
----------
ops: list of LinearOperator
Individual operators of the sum.
neg: list of bool
Same length as ops.
If True then the equivalent operator gets a minus in the sum.
"""
ops = tuple(ops)
neg = tuple(neg)
if len(ops) == 0:
......
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