numpy.ma.make_mask_none

numpy.ma.make_mask_none(newshape, dtype=None) [source]

Return a boolean mask of the given shape, filled with False.

This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type.

Parameters:

newshape : tuple

A tuple indicating the shape of the mask.

dtype : {None, dtype}, optional

If None, use a MaskType instance. Otherwise, use a new datatype with the same fields as dtype, converted to boolean types.

Returns:

result : ndarray

An ndarray of appropriate shape and dtype, filled with False.

See also

make_mask
Create a boolean mask from an array.
make_mask_descr
Construct a dtype description list from a given dtype.

Examples

>>> import numpy.ma as ma
>>> ma.make_mask_none((3,))
array([False, False, False], dtype=bool)

Defining a more complex dtype.

>>> dtype = np.dtype({'names':['foo', 'bar'],
                      'formats':[np.float32, np.int]})
>>> dtype
dtype([('foo', '<f4'), ('bar', '<i4')])
>>> ma.make_mask_none((3,), dtype=dtype)
array([(False, False), (False, False), (False, False)],
      dtype=[('foo', '|b1'), ('bar', '|b1')])

© 2008–2017 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.ma.make_mask_none.html