Commit da7fa813 authored by Reimar H Leike's avatar Reimar H Leike
Browse files

fixed selection operators to be compatible with zero-operator

parent 8bdf38d0
......@@ -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 it is probably None
return Field.full(, 0)
from ..multi.multi_field import MultiField
return MultiField.from_dict({self._key: x}, self._domain)
Supports Markdown
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