This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / core / flatten_mask

function

numpy.ma.core:flatten_mask

source: build-install/usr/lib/python3.14/site-packages/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_like

Input array, which will be interpreted as booleans.

Returns

flattened_mask : ndarray of bools

The 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