get_data_and_mask#

astropy.utils.masked.get_data_and_mask(array)[source]#

Split possibly masked array into unmasked and mask.

Parameters:
arrayarray_like

Possibly masked item, judged by whether it has a mask attribute. 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, maskarray_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).