MCPcopy Create free account
hub / github.com/numpy/numpy / test_asym

Method test_asym

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

Source from the content-addressed store, hash-verified

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])
213 y = array([1, 3, 2, 0, 1, 2, 3, 4])
214 H, xed, yed = histogram2d(
215 x, y, (6, 5), range=[[0, 6], [0, 5]], density=True)
216 answer = array(
217 [[0., 0, 0, 0, 0],
218 [0, 1, 0, 1, 0],
219 [0, 0, 1, 0, 0],
220 [1, 0, 0, 0, 0],
221 [0, 1, 1, 1, 0],
222 [0, 0, 0, 0, 1]])
223 assert_array_almost_equal(H, answer/8., 3)
224 assert_array_equal(xed, np.linspace(0, 6, 7))
225 assert_array_equal(yed, np.linspace(0, 5, 6))
226
227 def test_density(self):
228 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