Statistical characteristics of a histogram
Code: "histo_stat.py". Programming language: Python
DMelt Version 1.4. Last modified: 12/19/1970. License: Free
https://datamelt.org/code/cache/histo_stat_5993.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from jhplot import *
p0=P0D()
# 100 numbers (Normal distribution)
p0.randomNormal(1000,0.0,2.0) # mean=0, sigma=2
h1=H1D("Normal",40,-10,10)
h1.fill(p0) # fill a histogram with 1D array
c1=HPlot()
c1.visible(); c1.setAutoRange()
c1.draw(h1)
c1.drawStatBox(h1) # show statistics
stat= h1.getStat()
print stat["mean"],"+-",stat["mean_error"]