MCPcopy Index your code
hub / github.com/numpy/numpy / clump_unmasked

Function clump_unmasked

numpy/ma/extras.py:2139–2172  ·  view source on GitHub ↗

Return list of slices corresponding to the unmasked clumps of a 1-D array. (A "clump" is defined as a contiguous region of the array). Parameters ---------- a : ndarray A one-dimensional masked array. Returns ------- slices : list of slice The list

(a)

Source from the content-addressed store, hash-verified

2137
2138
2139def clump_unmasked(a):
2140 """
2141 Return list of slices corresponding to the unmasked clumps of a 1-D array.
2142 (A "clump" is defined as a contiguous region of the array).
2143
2144 Parameters
2145 ----------
2146 a : ndarray
2147 A one-dimensional masked array.
2148
2149 Returns
2150 -------
2151 slices : list of slice
2152 The list of slices, one for each continuous region of unmasked
2153 elements in `a`.
2154
2155 See Also
2156 --------
2157 flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges
2158 notmasked_contiguous, clump_masked
2159
2160 Examples
2161 --------
2162 >>> import numpy as np
2163 >>> a = np.ma.masked_array(np.arange(10))
2164 >>> a[[0, 1, 2, 6, 8, 9]] = np.ma.masked
2165 >>> np.ma.clump_unmasked(a)
2166 [slice(3, 6, None), slice(7, 8, None)]
2167
2168 """
2169 mask = getattr(a, '_mask', nomask)
2170 if mask is nomask:
2171 return [slice(0, a.size)]
2172 return _ezclump(~mask)
2173
2174
2175def clump_masked(a):

Callers 1

test_clump_unmaskedMethod · 0.90

Calls 2

sliceFunction · 0.85
_ezclumpFunction · 0.85

Tested by 1

test_clump_unmaskedMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…