(self)
| 183 | |
| 184 | class TestHistogram2d: |
| 185 | def test_simple(self): |
| 186 | x = array( |
| 187 | [0.41702200, 0.72032449, 1.1437481e-4, 0.302332573, 0.146755891]) |
| 188 | y = array( |
| 189 | [0.09233859, 0.18626021, 0.34556073, 0.39676747, 0.53881673]) |
| 190 | xedges = np.linspace(0, 1, 10) |
| 191 | yedges = np.linspace(0, 1, 10) |
| 192 | H = histogram2d(x, y, (xedges, yedges))[0] |
| 193 | answer = array( |
| 194 | [[0, 0, 0, 1, 0, 0, 0, 0, 0], |
| 195 | [0, 0, 0, 0, 0, 0, 1, 0, 0], |
| 196 | [0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 197 | [1, 0, 1, 0, 0, 0, 0, 0, 0], |
| 198 | [0, 1, 0, 0, 0, 0, 0, 0, 0], |
| 199 | [0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 200 | [0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 201 | [0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 202 | [0, 0, 0, 0, 0, 0, 0, 0, 0]]) |
| 203 | assert_array_equal(H.T, answer) |
| 204 | H = histogram2d(x, y, xedges)[0] |
| 205 | assert_array_equal(H.T, answer) |
| 206 | H, xedges, yedges = histogram2d(list(range(10)), list(range(10))) |
| 207 | assert_array_equal(H, eye(10, 10)) |
| 208 | assert_array_equal(xedges, np.linspace(0, 9, 11)) |
| 209 | assert_array_equal(yedges, np.linspace(0, 9, 11)) |
| 210 | |
| 211 | def test_asym(self): |
| 212 | x = array([1, 1, 2, 3, 4, 4, 4, 5]) |
nothing calls this directly
no test coverage detected