MCPcopy Create free account
hub / github.com/dask/dask / test_average_weights_with_masked_array

Function test_average_weights_with_masked_array

dask/array/tests/test_masked.py:379–389  ·  view source on GitHub ↗
(keepdims)

Source from the content-addressed store, hash-verified

377
378@pytest.mark.parametrize("keepdims", [False, True])
379def test_average_weights_with_masked_array(keepdims):
380 mask = np.array([[True, False], [True, True], [False, True]])
381 data = np.arange(6).reshape((3, 2))
382 a = np.ma.array(data, mask=mask)
383 d_a = da.ma.masked_array(data=data, mask=mask, chunks=2)
384
385 weights = np.array([0.25, 0.75])
386 d_weights = da.from_array(weights, chunks=2)
387
388 da_avg = da.ma.average(d_a, weights=d_weights, axis=1, keepdims=keepdims)
389 assert_eq(da_avg, np.ma.average(a, weights=weights, axis=1, keepdims=keepdims))
390
391
392def test_arithmetic_results_in_masked():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45

Tested by

no test coverage detected