eelbrain.NDVar.mask
- NDVar.mask(mask, name=None, missing=None, fill_value=None)
Create a masked version of this NDVar (see
numpy.ma.MaskedArray)- Parameters:
mask (bool NDVar) – Mask, with equal dimensions (
Truevalues 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., whenmask’s dimensions only cover part of the NDVar). The default is to raise aValueErrorifmaskis missing values.fill_value – Value to substitute for masked values if necessary (see
numpy.ma.MaskedArray).
Examples
In operations such as
NDVar.mean(), standardnumpybehavior 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