(self)
| 72 | assert_equal(counts, [.25, 0]) |
| 73 | |
| 74 | def test_outliers(self): |
| 75 | # Check that outliers are not tallied |
| 76 | a = np.arange(10) + .5 |
| 77 | |
| 78 | # Lower outliers |
| 79 | h, b = histogram(a, range=[0, 9]) |
| 80 | assert_equal(h.sum(), 9) |
| 81 | |
| 82 | # Upper outliers |
| 83 | h, b = histogram(a, range=[1, 10]) |
| 84 | assert_equal(h.sum(), 9) |
| 85 | |
| 86 | # Normalization |
| 87 | h, b = histogram(a, range=[1, 9], density=True) |
| 88 | assert_almost_equal((h * np.diff(b)).sum(), 1, decimal=15) |
| 89 | |
| 90 | # Weights |
| 91 | w = np.arange(10) + .5 |
| 92 | h, b = histogram(a, range=[1, 9], weights=w, density=True) |
| 93 | assert_equal((h * np.diff(b)).sum(), 1) |
| 94 | |
| 95 | h, b = histogram(a, bins=8, range=[1, 9], weights=w) |
| 96 | assert_equal(h, w[1:-1]) |
| 97 | |
| 98 | def test_arr_weights_mismatch(self): |
| 99 | a = np.arange(10) + .5 |
nothing calls this directly
no test coverage detected