Test whether input is an instance of MaskedArray. This function returns True if `x` is an instance of MaskedArray and returns False otherwise. Any object is accepted as input. Parameters ---------- x : object Object to test. Returns ------- result : b
(x)
| 6483 | |
| 6484 | |
| 6485 | def isMaskedArray(x): |
| 6486 | """ |
| 6487 | Test whether input is an instance of MaskedArray. |
| 6488 | |
| 6489 | This function returns True if `x` is an instance of MaskedArray |
| 6490 | and returns False otherwise. Any object is accepted as input. |
| 6491 | |
| 6492 | Parameters |
| 6493 | ---------- |
| 6494 | x : object |
| 6495 | Object to test. |
| 6496 | |
| 6497 | Returns |
| 6498 | ------- |
| 6499 | result : bool |
| 6500 | True if `x` is a MaskedArray. |
| 6501 | |
| 6502 | See Also |
| 6503 | -------- |
| 6504 | isMA : Alias to isMaskedArray. |
| 6505 | isarray : Alias to isMaskedArray. |
| 6506 | |
| 6507 | Examples |
| 6508 | -------- |
| 6509 | >>> import numpy.ma as ma |
| 6510 | >>> a = np.eye(3, 3) |
| 6511 | >>> a |
| 6512 | array([[ 1., 0., 0.], |
| 6513 | [ 0., 1., 0.], |
| 6514 | [ 0., 0., 1.]]) |
| 6515 | >>> m = ma.masked_values(a, 0) |
| 6516 | >>> m |
| 6517 | masked_array( |
| 6518 | data=[[1.0, --, --], |
| 6519 | [--, 1.0, --], |
| 6520 | [--, --, 1.0]], |
| 6521 | mask=[[False, True, True], |
| 6522 | [ True, False, True], |
| 6523 | [ True, True, False]], |
| 6524 | fill_value=0.0) |
| 6525 | >>> ma.isMaskedArray(a) |
| 6526 | False |
| 6527 | >>> ma.isMaskedArray(m) |
| 6528 | True |
| 6529 | >>> ma.isMaskedArray([0, 1, 2]) |
| 6530 | False |
| 6531 | |
| 6532 | """ |
| 6533 | return isinstance(x, MaskedArray) |
| 6534 | |
| 6535 | |
| 6536 | isarray = isMaskedArray |
no outgoing calls