MCPcopy Index your code
hub / github.com/dask/dask / test_nonzero

Function test_nonzero

dask/array/tests/test_masked.py:452–471  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

450
451
452def test_nonzero():
453 data = np.arange(9).reshape((3, 3))
454 mask = np.array([[True, False, False], [True, True, False], [True, False, True]])
455 a = np.ma.array(data, mask=mask)
456 d_a = da.ma.masked_array(data=data, mask=mask, chunks=2)
457
458 for c1, c2 in [
459 (a > 4, d_a > 4),
460 (a, d_a),
461 (a <= -2, d_a <= -2),
462 (a == 0, d_a == 0),
463 ]:
464 sol = np.ma.nonzero(c1)
465 res = da.ma.nonzero(c2)
466
467 assert isinstance(res, type(sol))
468 assert len(res) == len(sol)
469
470 for i in range(len(sol)):
471 assert_eq(res[i], sol[i])
472
473
474def test_where():

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
reshapeMethod · 0.80
nonzeroMethod · 0.80
arangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…