Skip to main content
`Ctrl`+`K`

# Masked

class astropy.utils.masked.Masked(*args, **kwargs)

  Bases: `NDArrayShapeMethods`

  A scalar value or array of values with associated mask.

  The resulting instance will take its exact type from whatever the contents are, with the type generated on the fly as needed.

  Parameters:
    data numpy:array_like

      The data for which a mask is to be added. The result will be a a subclass of the type of `data`.

    mask numpy:array_like of bool, optional

      The initial mask to assign. If not given, taken from the data. If the data already has a mask, the masks are combined.

    copy bool

      Whether the data and mask should be copied. Default: `False`.

  Attributes Summary

  `mask` | The mask.
  `unmasked` | The unmasked values.

  Methods Summary

  `filled`(fill_value) | Get a copy of the underlying data, with masked values filled in.
  `from_unmasked`(data[, mask, copy]) | Create an instance from unmasked data and a mask.

  Attributes Documentation

  mask

    The mask.

    If set, replace the original mask, with whatever it is set with, using a view if no broadcasting or type conversion is required.

  unmasked

    The unmasked values.

    See also

    `astropy.utils.masked.Masked.filled`

  Methods Documentation

  filled(fill_value)

    Get a copy of the underlying data, with masked values filled in.

    Parameters:
      fill_value `object`

        Value to replace masked values with.

    See also

    `astropy.utils.masked.Masked.unmasked`
  classmethod from_unmasked(data, mask=None, copy=None)

    Create an instance from unmasked data and a mask.