astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Astropy Core Package Utilities (`astropy.utils`) »
- Masked Values (`astropy.utils.masked`) »
- Masked

# 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.

    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=False)

    Create an instance from unmasked data and a mask.