MCPcopy Create free account
hub / github.com/numpy/numpy / make_mask_none

Function make_mask_none

numpy/ma/core.py:1644–1691  ·  view source on GitHub ↗

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, dtype=None)

Source from the content-addressed store, hash-verified

1642
1643
1644def make_mask_none(newshape, dtype=None):
1645 """
1646 Return a boolean mask of the given shape, filled with False.
1647
1648 This function returns a boolean ndarray with all entries False, that can
1649 be used in common mask manipulations. If a complex dtype is specified, the
1650 type of each field is converted to a boolean type.
1651
1652 Parameters
1653 ----------
1654 newshape : tuple
1655 A tuple indicating the shape of the mask.
1656 dtype : {None, dtype}, optional
1657 If None, use a MaskType instance. Otherwise, use a new datatype with
1658 the same fields as `dtype`, converted to boolean types.
1659
1660 Returns
1661 -------
1662 result : ndarray
1663 An ndarray of appropriate shape and dtype, filled with False.
1664
1665 See Also
1666 --------
1667 make_mask : Create a boolean mask from an array.
1668 make_mask_descr : Construct a dtype description list from a given dtype.
1669
1670 Examples
1671 --------
1672 >>> import numpy.ma as ma
1673 >>> ma.make_mask_none((3,))
1674 array([False, False, False])
1675
1676 Defining a more complex dtype.
1677
1678 >>> dtype = np.dtype({'names':['foo', 'bar'],
1679 ... 'formats':[np.float32, np.int64]})
1680 >>> dtype
1681 dtype([('foo', '<f4'), ('bar', '<i8')])
1682 >>> ma.make_mask_none((3,), dtype=dtype)
1683 array([(False, False), (False, False), (False, False)],
1684 dtype=[('foo', '|b1'), ('bar', '|b1')])
1685
1686 """
1687 if dtype is None:
1688 result = np.zeros(newshape, dtype=MaskType)
1689 else:
1690 result = np.zeros(newshape, dtype=make_mask_descr(dtype))
1691 return result
1692
1693
1694def _recursive_mask_or(m1, m2, newmask):

Callers 14

getmaskarrayFunction · 0.85
masked_invalidFunction · 0.85
__setitem__Method · 0.85
__setmask__Method · 0.85
__iadd__Method · 0.85
__isub__Method · 0.85
__imul__Method · 0.85
sumMethod · 0.85
prodMethod · 0.85
meanMethod · 0.85
minMethod · 0.85
maxMethod · 0.85

Calls 1

make_mask_descrFunction · 0.85

Tested by

no test coverage detected