예제 #1
0
def test_general_density():
    """
    Test general density -- whether Hist density work properly.
    """

    for data in range(10, 20, 10):
        h = Hist(axis.Regular(10, -3, 3, name="x")).fill(np.random.randn(data))
        assert pytest.approx(sum(h.density()), 2) == pytest.approx(10 / 6, 2)
예제 #2
0
def test_weighted_density():
    for data in range(10, 20, 10):
        h = Hist(axis.Regular(10, -3, 3, name="x"),
                 storage="weight").fill(np.random.randn(data))
        assert pytest.approx(sum(h.density()), 2) == pytest.approx(10 / 6, 2)