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