Skip to content
GitLab
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
da7fa813
Commit
da7fa813
authored
Jul 11, 2018
by
Reimar H Leike
Browse files
fixed selection operators to be compatible with zero-operator
parent
8bdf38d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/selection_operator.py
View file @
da7fa813
...
...
@@ -20,6 +20,7 @@ from __future__ import absolute_import, division, print_function
from
..compat
import
*
from
.linear_operator
import
LinearOperator
from
..multi.multi_domain
import
MultiDomain
from
..field
import
Field
class
SelectionOperator
(
LinearOperator
):
...
...
@@ -52,7 +53,11 @@ class SelectionOperator(LinearOperator):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
mode
==
self
.
TIMES
:
return
x
[
self
.
_key
]
if
isinstance
(
x
[
self
.
_key
],
Field
):
return
x
[
self
.
_key
]
else
:
#else it is probably None
return
Field
.
full
(
self
.
target
,
0
)
else
:
from
..multi.multi_field
import
MultiField
return
MultiField
.
from_dict
({
self
.
_key
:
x
},
self
.
_domain
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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