Commit 78464494 authored by Philipp Arras's avatar Philipp Arras

Docs

parent aea26fdf
......@@ -19,6 +19,12 @@ from .operator import Operator
class OffsetOperator(Operator):
'''Shifts the input by a fixed field.
Parameters
----------
field : Field
The field by which the input is shifted.'''
def __init__(self, field):
self._field = field
self._domain = self._target = field.domain
......
......@@ -26,16 +26,23 @@ class Operator(NiftyMetaBase()):
@property
def domain(self):
"""DomainTuple or MultiDomain : the operator's input domain
"""The domain on which the Operator's input Field is defined.
The domain on which the Operator's input Field is defined."""
Returns
-------
domain : DomainTuple or MultiDomain
"""
return self._domain
@property
def target(self):
"""DomainTuple or MultiDomain : the operator's output domain
"""The domain on which the Operator's output Field is defined.
Returns
-------
target : DomainTuple or MultiDomain
"""
The domain on which the Operator's output Field is defined."""
return self._target
@staticmethod
......@@ -103,10 +110,19 @@ class Operator(NiftyMetaBase()):
return _OpChain.make((_Clipper(self.target, min, max), self))
def apply(self, x):
'''Applies the operator to a Field or MultiField.
Parameters
----------
x : Field or MultiField
Input on which the operator shall act. Needs to be defined on
:attr:`domain`.
'''
raise NotImplementedError
def force(self, x):
"""Extract correct subset of domain of x and apply operator."""
"""Extract subset of domain of x according to `self.domain` and apply
operator."""
return self.apply(x.extract(self.domain))
def _check_input(self, x):
......
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