예제 #1
0
def test_compute_breaks():
    points = 10000
    bins = 25
    from numpy import histogram, allclose
    data = make_normal(points)
    h1 = StreamHist().update(data)
    h2, es2 = histogram(data, bins=bins)
    h3, es3 = h1.compute_breaks(bins)

    assert allclose(es2, es3)
    assert allclose(h2, h3, rtol=1, atol=points/(bins**2))
예제 #2
0
def test_compute_breaks():
    points = 10000
    bins = 25
    from numpy import histogram, allclose
    data = make_normal(points)
    h1 = StreamHist().update(data)
    h2, es2 = histogram(data, bins=bins)
    h3, es3 = h1.compute_breaks(bins)

    assert allclose(es2, es3)
    assert allclose(h2, h3, rtol=1, atol=points / (bins**2))
예제 #3
0
def test_compute_breaks_with_min_max():
    points = 10000
    bins = 25
    from numpy import histogram, allclose
    data = make_normal(points)
    h1 = StreamHist().update(data)
    h2, es2 = histogram(data, bins=bins, range=(-10, 10))
    h3, es3 = h1.compute_breaks(bins, minimum=-10, maximum=10)

    assert allclose(es2, es3)
    assert allclose(h2, h3, rtol=1, atol=points / (bins**2))