()
| 755 | |
| 756 | |
| 757 | def test_histogram(): |
| 758 | # Test for normal, flattened input |
| 759 | n = 100 |
| 760 | v = da.random.default_rng().random(n, chunks=10) |
| 761 | bins = np.arange(0, 1.01, 0.01) |
| 762 | a1, b1 = da.histogram(v, bins=bins) |
| 763 | a2, b2 = np.histogram(v, bins=bins) |
| 764 | |
| 765 | # Check if the sum of the bins equals the number of samples |
| 766 | assert a2.sum(axis=0) == n |
| 767 | assert a1.sum(axis=0) == n |
| 768 | assert_eq(a1, a2) |
| 769 | assert same_keys(da.histogram(v, bins=bins)[0], a1) |
| 770 | |
| 771 | |
| 772 | def test_histogram_alternative_bins_range(): |