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

Function test_histogram_delayed_range

dask/array/tests/test_routines.py:866–895  ·  view source on GitHub ↗
(density, weighted, non_delayed_i, delay_n_bins)

Source from the content-addressed store, hash-verified

864@pytest.mark.parametrize("non_delayed_i", [None, 0])
865@pytest.mark.parametrize("delay_n_bins", [False, True])
866def test_histogram_delayed_range(density, weighted, non_delayed_i, delay_n_bins):
867 n = 100
868 v = np.random.default_rng().random(n)
869 vd = da.from_array(v, chunks=2)
870
871 if weighted:
872 weights = np.random.default_rng().random(n)
873 weights_d = da.from_array(weights, chunks=vd.chunks)
874
875 d_range = [vd.min(), vd.max()]
876 if non_delayed_i is not None:
877 d_range[non_delayed_i] = d_range[non_delayed_i].compute()
878 hist_d, bins_d = da.histogram(
879 vd,
880 bins=da.array(n) if delay_n_bins and not density else n,
881 range=d_range,
882 density=density,
883 weights=weights_d if weighted else None,
884 )
885
886 hist, bins = np.histogram(
887 v,
888 bins=n,
889 range=[v.min(), v.max()],
890 density=density,
891 weights=weights if weighted else None,
892 )
893
894 assert_eq(hist_d, hist)
895 assert_eq(bins_d, bins)
896
897
898@pytest.mark.parametrize("density", [True, False])

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
randomMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected