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

Method test_asym

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

Source from the content-addressed store, hash-verified

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])
231 y = array([1, 3, 2, 0, 1, 2, 3, 4])
232 H, xed, yed = histogram2d(
233 x, y, (6, 5), range=[[0, 6], [0, 5]], density=True)
234 answer = array(
235 [[0., 0, 0, 0, 0],
236 [0, 1, 0, 1, 0],
237 [0, 0, 1, 0, 0],
238 [1, 0, 0, 0, 0],
239 [0, 1, 1, 1, 0],
240 [0, 0, 0, 0, 1]])
241 assert_array_almost_equal(H, answer / 8., 3)
242 assert_array_equal(xed, np.linspace(0, 6, 7))
243 assert_array_equal(yed, np.linspace(0, 5, 6))
244
245 def test_density(self):
246 x = array([1, 2, 3, 1, 2, 3, 1, 2, 3])

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected