| 19 | ) |
| 20 | @pytest.mark.parametrize("single_dim", [True, False]) |
| 21 | def test_measures(kind, kwargs, single_dim): |
| 22 | np.random.seed(seed=1337) |
| 23 | if single_dim: |
| 24 | x = np.random.random(size=(30,)) |
| 25 | else: |
| 26 | x = np.random.random(size=(30, 2)) |
| 27 | y = da.from_array(x, 3) |
| 28 | dfunc = getattr(dask.array.stats, kind) |
| 29 | sfunc = getattr(scipy.stats, kind) |
| 30 | |
| 31 | expected = sfunc(x, **kwargs) |
| 32 | result = dfunc(y, **kwargs) |
| 33 | if np.isscalar(expected): |
| 34 | # make it an array to account for possible numeric errors |
| 35 | expected = np.array(expected) |
| 36 | assert_eq(result, expected) |
| 37 | assert isinstance(result, da.Array) |
| 38 | |
| 39 | |
| 40 | def test_bias_raises(): |