Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
78464494
Commit
78464494
authored
Jan 14, 2019
by
Philipp Arras
Browse files
Docs
parent
aea26fdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/offset_operator.py
View file @
78464494
...
...
@@ -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
...
...
nifty5/operators/operator.py
View file @
78464494
...
...
@@ -26,16 +26,23 @@ class Operator(NiftyMetaBase()):
@
property
def
domain
(
self
):
"""
DomainTuple or MultiDomain :
the
o
perator's input
domain
"""
The domain on which
the
O
perator'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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment