(self)
| 1318 | return array(np.random.rand(12)) |
| 1319 | |
| 1320 | def test_covhelper(self): |
| 1321 | x = self._create_data() |
| 1322 | # Test not mask output type is a float. |
| 1323 | assert_(_covhelper(x, rowvar=True)[1].dtype, np.float32) |
| 1324 | assert_(_covhelper(x, y=x, rowvar=False)[1].dtype, np.float32) |
| 1325 | # Test not mask output is equal after casting to float. |
| 1326 | mask = x > 0.5 |
| 1327 | assert_array_equal( |
| 1328 | _covhelper( |
| 1329 | np.ma.masked_array(x, mask), rowvar=True |
| 1330 | )[1].astype(bool), |
| 1331 | ~mask.reshape(1, -1), |
| 1332 | ) |
| 1333 | assert_array_equal( |
| 1334 | _covhelper( |
| 1335 | np.ma.masked_array(x, mask), y=x, rowvar=False |
| 1336 | )[1].astype(bool), |
| 1337 | np.vstack((~mask, ~mask)), |
| 1338 | ) |
| 1339 | |
| 1340 | def test_1d_without_missing(self): |
| 1341 | # Test cov on 1D variable w/o missing values |
nothing calls this directly
no test coverage detected