Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list of two tuples, corresponding to the indices of the first and last unmasked values respectively.
Parameters : | a : array_like
axis : int, optional
|
---|---|
Returns : | edges : ndarray or list
|
Examples
>>> a = np.arange(9).reshape((3, 3))
>>> m = np.zeros_like(a)
>>> m[1:, 1:] = 1
>>> ma = np.ma.array(a, mask=m)
>>> np.array(ma[~ma.mask])
array([0, 1, 2, 3, 6])
>>> np.ma.extras.notmasked_edges(ma)
array([0, 6])