def test_fill(): h = Histogram(axis=Axis(100, -50, 50)) weight = 0.25 for i in xrange(-50,50) : h.fill(i+0.5, weight) assert h.entries() == 100 assert h.integral() == 100*weight
def test_integral() : h = Histogram(axis=Axis(100, -50., 50.)) weight = 0.5 for x in xrange(10) : h.fill(-49.99, weight) # should be 0th bin h.fill(49.99, weight) # should be 100th bin, ie index 99 h.fill(0.1, 2*weight) assert h.integral() == 10*4*weight
def test_integral_does_not_count_out_of_range_entries() : h = Histogram(axis=Axis(100, -50., 50.)) h.fill(45.5, 10.) h.fill(100.) h.fill(-100) assert h.integral() == 10.