MCPcopy Index your code
hub / github.com/numpy/numpy / test_simple

Method test_simple

numpy/lib/tests/test_twodim_base.py:203–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

201
202class TestHistogram2d:
203 def test_simple(self):
204 x = array(
205 [0.41702200, 0.72032449, 1.1437481e-4, 0.302332573, 0.146755891])
206 y = array(
207 [0.09233859, 0.18626021, 0.34556073, 0.39676747, 0.53881673])
208 xedges = np.linspace(0, 1, 10)
209 yedges = np.linspace(0, 1, 10)
210 H = histogram2d(x, y, (xedges, yedges))[0]
211 answer = array(
212 [[0, 0, 0, 1, 0, 0, 0, 0, 0],
213 [0, 0, 0, 0, 0, 0, 1, 0, 0],
214 [0, 0, 0, 0, 0, 0, 0, 0, 0],
215 [1, 0, 1, 0, 0, 0, 0, 0, 0],
216 [0, 1, 0, 0, 0, 0, 0, 0, 0],
217 [0, 0, 0, 0, 0, 0, 0, 0, 0],
218 [0, 0, 0, 0, 0, 0, 0, 0, 0],
219 [0, 0, 0, 0, 0, 0, 0, 0, 0],
220 [0, 0, 0, 0, 0, 0, 0, 0, 0]])
221 assert_array_equal(H.T, answer)
222 H = histogram2d(x, y, xedges)[0]
223 assert_array_equal(H.T, answer)
224 H, xedges, yedges = histogram2d(list(range(10)), list(range(10)))
225 assert_array_equal(H, eye(10, 10))
226 assert_array_equal(xedges, np.linspace(0, 9, 11))
227 assert_array_equal(yedges, np.linspace(0, 9, 11))
228
229 def test_asym(self):
230 x = array([1, 1, 2, 3, 4, 4, 4, 5])

Callers

nothing calls this directly

Calls 5

arrayFunction · 0.90
histogram2dFunction · 0.90
assert_array_equalFunction · 0.90
eyeFunction · 0.90
linspaceMethod · 0.80

Tested by

no test coverage detected