from jhplot import H1D
from java.util import Random
h1 = H1D("H1",20, -1, 1)
h2 = H1D("H2",20, -1, 1)
rand = Random()
# fill histograms sligly differently. Second distribution is narrower
for i in range(100):
d=rand.nextGaussian()
h1.fill(d)
h2.fill(d*0.9)
# compare histograms
d=h1.compareChi2(h2) # h1, h2 are H1D or H2D histograms defined above
print "chi2 / ndf =",d["chi2"]/d["ndf"]
print "p-value=",d["p-value"]
from hep.aida.util.comparison import *
r=StatisticalComparison.compare(h1.get(), h2.get(),'KS')
print"KolmogorovSmirnov method=",r.quality() ,"/",r.nDof()