Return True if array `x` consists only of binary values
(x)
| 49 | |
| 50 | |
| 51 | def is_binary(x): |
| 52 | """Return True if array `x` consists only of binary values""" |
| 53 | msg = "Matrix must be binary" |
| 54 | assert np.array_equal(x, x.astype(bool)), msg |
| 55 | return True |
| 56 | |
| 57 | |
| 58 | ####################################################################### |