diff --git a/pyramid/fielddata.py b/pyramid/fielddata.py index 91fca4f7c76e13e78c16ec4d0c08619677019bc9..3f206feca3ce423bd5d59784f0d6e17324618341 100644 --- a/pyramid/fielddata.py +++ b/pyramid/fielddata.py @@ -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: diff --git a/pyramid/phasemap.py b/pyramid/phasemap.py index 57d1cb896fb26aab677f1213b1be2e241bc6a5a3..ef45f178450c13ddeae80e2646e4d03c766c47aa 100644 --- a/pyramid/phasemap.py +++ b/pyramid/phasemap.py @@ -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: