Skip to content
Snippets Groups Projects
Commit 0026773d authored by Jan Caron's avatar Jan Caron
Browse files

__getitem__ implemented for PhaseMap and FieldData.

parent c8a144c6
No related branches found
No related tags found
No related merge requests found
......@@ -182,7 +182,10 @@ class FieldData(object, metaclass=abc.ABCMeta):
self._log.debug('Calling __ifloordiv__')
return self.__floordiv__(other)
def __array__(self, dtype=None):
def __getitem__(self, item):
return self.__class__(self.a, self.field[item])
def __array__(self, dtype=None): # Used for numpy ufuncs, together with __array_wrap__!
if dtype:
return self.field.astype(dtype)
else:
......
......@@ -264,7 +264,10 @@ class PhaseMap(object):
self._log.debug('Calling __ifloordiv__')
return self.__floordiv__(other)
def __array__(self, dtype=None):
def __getitem__(self, item):
return PhaseMap(self.a, self.phase[item], self.mask[item], self.confidence[item])
def __array__(self, dtype=None): # Used for numpy ufuncs, together with __array_wrap__!
if dtype:
return self.phase.astype(dtype)
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment