eelbrain.NDVar.mask

NDVar.mask(mask, name=None, missing=None)

Create a masked version of this NDVar (see numpy.ma.MaskedArray)

Parameters:
  • mask (bool NDVar) – Mask, with equal dimensions (True values will be masked).

  • name (str) – Name of the output NDVar (default is the current name).

  • missing (bool) – Whether to mask values that are outside of mask (i.e., when mask’s dimensions only cover part of the NDVar). The default is to raise a ValueError if mask is missing values.

See also

unmask

remove mask

get_mask

retrieve mask

Examples

In operations such as NDVar.mean(), standard numpy behavior applies, i.e., masked values are ignored:

>>> x = NDVar([1, 2, 3], Case)
>>> x.mean()
2.0
>>> y = x.mask([True, False, False])
>>> y.mean()
2.5