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

Function make_mask_descr

numpy/ma/core.py:1377–1408  ·  view source on GitHub ↗

Construct a dtype description list from a given dtype. Returns a new dtype object, with the type of all fields in `ndtype` to a boolean type. Field names are not altered. Parameters ---------- ndtype : dtype The dtype to convert. Returns ------- result

(ndtype)

Source from the content-addressed store, hash-verified

1375
1376
1377def make_mask_descr(ndtype):
1378 """
1379 Construct a dtype description list from a given dtype.
1380
1381 Returns a new dtype object, with the type of all fields in `ndtype` to a
1382 boolean type. Field names are not altered.
1383
1384 Parameters
1385 ----------
1386 ndtype : dtype
1387 The dtype to convert.
1388
1389 Returns
1390 -------
1391 result : dtype
1392 A dtype that looks like `ndtype`, the type of all fields is boolean.
1393
1394 Examples
1395 --------
1396 >>> import numpy as np
1397 >>> import numpy.ma as ma
1398 >>> dtype = np.dtype({'names':['foo', 'bar'],
1399 ... 'formats':[np.float32, np.int64]})
1400 >>> dtype
1401 dtype([('foo', '<f4'), ('bar', '<i8')])
1402 >>> ma.make_mask_descr(dtype)
1403 dtype([('foo', '|b1'), ('bar', '|b1')])
1404 >>> ma.make_mask_descr(np.float32)
1405 dtype('bool')
1406
1407 """
1408 return _replace_dtype_fields(ndtype, MaskType)
1409
1410
1411def getmask(a):

Callers 12

genfromtxtFunction · 0.90
test_make_mask_descrMethod · 0.90
make_maskFunction · 0.85
make_mask_noneFunction · 0.85
__new__Method · 0.85
__array_finalize__Method · 0.85
_set_dtypeMethod · 0.85
__setstate__Method · 0.85
_mareconstructFunction · 0.85
__new__Method · 0.85
masked_allFunction · 0.85
masked_all_likeFunction · 0.85

Calls 1

_replace_dtype_fieldsFunction · 0.85

Tested by 1

test_make_mask_descrMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…