MCPcopy Index your code
hub / github.com/numpy/numpy / getmaskarray

Function getmaskarray

numpy/ma/core.py:1474–1525  ·  view source on GitHub ↗

Return the mask of a masked array, or full boolean array of False. Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and the mask is not `nomask`, else return a full boolean array of False of the same shape as `arr`. Parameters ---------- arr : array_l

(arr)

Source from the content-addressed store, hash-verified

1472
1473
1474def getmaskarray(arr):
1475 """
1476 Return the mask of a masked array, or full boolean array of False.
1477
1478 Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and
1479 the mask is not `nomask`, else return a full boolean array of False of
1480 the same shape as `arr`.
1481
1482 Parameters
1483 ----------
1484 arr : array_like
1485 Input `MaskedArray` for which the mask is required.
1486
1487 See Also
1488 --------
1489 getmask : Return the mask of a masked array, or nomask.
1490 getdata : Return the data of a masked array as an ndarray.
1491
1492 Examples
1493 --------
1494 >>> import numpy as np
1495 >>> import numpy.ma as ma
1496 >>> a = ma.masked_equal([[1,2],[3,4]], 2)
1497 >>> a
1498 masked_array(
1499 data=[[1, --],
1500 [3, 4]],
1501 mask=[[False, True],
1502 [False, False]],
1503 fill_value=2)
1504 >>> ma.getmaskarray(a)
1505 array([[False, True],
1506 [False, False]])
1507
1508 Result when mask == ``nomask``
1509
1510 >>> b = ma.masked_array([[1,2],[3,4]])
1511 >>> b
1512 masked_array(
1513 data=[[1, 2],
1514 [3, 4]],
1515 mask=False,
1516 fill_value=999999)
1517 >>> ma.getmaskarray(b)
1518 array([[False, False],
1519 [False, False]])
1520
1521 """
1522 mask = getmask(arr)
1523 if mask is nomask:
1524 mask = make_mask_none(np.shape(arr), getattr(arr, 'dtype', None))
1525 return mask
1526
1527
1528def is_mask(m):

Callers 15

test_2d_with_missingMethod · 0.90
test_getmaskarrayMethod · 0.90
__call__Method · 0.85
outerMethod · 0.85
flatten_structured_arrayFunction · 0.85
__setitem__Method · 0.85
__new__Method · 0.85
__array_finalize__Method · 0.85
__array_wrap__Method · 0.85
__getitem__Method · 0.85
putMethod · 0.85

Calls 3

getmaskFunction · 0.85
make_mask_noneFunction · 0.85
shapeMethod · 0.45

Tested by 3

test_2d_with_missingMethod · 0.72
test_getmaskarrayMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…