Return the next value, or raise StopIteration. Examples -------- >>> import numpy as np >>> x = np.ma.array([3, 2], mask=[0, 1]) >>> fl = x.flat >>> next(fl) 3 >>> next(fl) masked >>> next(fl) Traceback
(self)
| 2738 | self.maskiter[index] = getmaskarray(value) |
| 2739 | |
| 2740 | def __next__(self): |
| 2741 | """ |
| 2742 | Return the next value, or raise StopIteration. |
| 2743 | |
| 2744 | Examples |
| 2745 | -------- |
| 2746 | >>> import numpy as np |
| 2747 | >>> x = np.ma.array([3, 2], mask=[0, 1]) |
| 2748 | >>> fl = x.flat |
| 2749 | >>> next(fl) |
| 2750 | 3 |
| 2751 | >>> next(fl) |
| 2752 | masked |
| 2753 | >>> next(fl) |
| 2754 | Traceback (most recent call last): |
| 2755 | ... |
| 2756 | StopIteration |
| 2757 | |
| 2758 | """ |
| 2759 | d = next(self.dataiter) |
| 2760 | if self.maskiter is not None: |
| 2761 | m = next(self.maskiter) |
| 2762 | if isinstance(m, np.void): |
| 2763 | return mvoid(d, mask=m, hardmask=self.ma._hardmask) |
| 2764 | elif m: # Just a scalar, masked |
| 2765 | return masked |
| 2766 | return d |
| 2767 | |
| 2768 | |
| 2769 | @set_module("numpy.ma") |
no test coverage detected