Skip to main content
`Ctrl`+`K`

# numpy.ma.flatten_mask

ma.flatten_mask(mask)

  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)
      array([False, False,  True])

      >>> mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])
      >>> np.ma.flatten_mask(mask)
      array([False, False, False,  True])

      >>> mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])]
      >>> mask = np.array([(0, (0, 0)), (0, (0, 1))], dtype=mdtype)
      >>> np.ma.flatten_mask(mask)
      array([False, False, False, False, False,  True])