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)
| 1375 | |
| 1376 | |
| 1377 | def 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 | |
| 1411 | def getmask(a): |
searching dependent graphs…