eelbrain.NDVar.mask

NDVar.mask(self, 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 missing in mask; the default is to raise a TypeError if mask is missing values.

See also

unmask
remove 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