bundles / numpy 2.4.4 / numpy / ma / core / flatten_mask
function
numpy.ma.core:flatten_mask
source: /numpy/ma/core.py :1805
Signature
def flatten_mask ( mask ) Summary
Returns a completely flattened version of the mask, where nested fields are collapsed.
Parameters
mask: array_likeInput array, which will be interpreted as booleans.
Returns
flattened_mask: ndarray of boolsThe flattened input.
Examples
import numpy as np mask = np.array([0, 0, 1]) np.ma.flatten_mask(mask)
mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)]) np.ma.flatten_mask(mask)
mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])] mask = np.array([(0, (0, 0)), (0, (0, 1))], dtype=mdtype) np.ma.flatten_mask(mask)
Aliases
-
numpy.ma.flatten_mask