Skip to main content
`Ctrl`+`K`

# get_data_and_mask

astropy.utils.masked.get_data_and_mask(array)

  Split possibly masked array into unmasked and mask.

  Parameters:
    array numpy:array_like

      Possibly masked item, judged by whether it has a `mask` attribute (but ignored when a possible `masked` attribute is `False`). If so, checks for having an `unmasked` attribute (as expected for instances of `Masked`), or uses the `_data` attribute if the inpuit is an instance of `MaskedArray`.

  Returns:
    unmasked, mask numpy:array_like

      If the input array had no mask, this will be `array, None`.

  Raises:
    `AttributeError`

      If `array` has a `mask` but not an `unmasked` attribute, and is not an instance of `MaskedArray`.

    `ValueError`

      If `array` is `np.ma.masked` (since it has no data).