MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _total_to_compress_renum

Method _total_to_compress_renum

lib/matplotlib/tri/_tritools.py:242–263  ·  view source on GitHub ↗

Parameters ---------- valid : 1D bool array Validity mask. Returns ------- int array Array so that (`valid_array` being a compressed array based on a `masked_array` with mask ~*valid*): - For all i wit

(valid)

Source from the content-addressed store, hash-verified

240
241 @staticmethod
242 def _total_to_compress_renum(valid):
243 """
244 Parameters
245 ----------
246 valid : 1D bool array
247 Validity mask.
248
249 Returns
250 -------
251 int array
252 Array so that (`valid_array` being a compressed array
253 based on a `masked_array` with mask ~*valid*):
254
255 - For all i with valid[i] = True:
256 valid_array[renum[i]] = masked_array[i]
257 - For all i with valid[i] = False:
258 renum[i] = -1 (invalid value)
259 """
260 renum = np.full(np.size(valid), -1, dtype=np.int32)
261 n_valid = np.sum(valid)
262 renum[valid] = np.arange(n_valid, dtype=np.int32)
263 return renum

Callers 1

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected