Home | News | Documentation | Download

Quantile of a TH1 using GetQuantiles()

Dear,

I’m trying to get the quantile value for 60%, and here is what I’m doing

h = ROOT.TH1F(“h”,“demo quantiles”,100,-3,3)
h.FillRandom(“gaus”,5000)
prob=np.array([0.6])
q=np.array([0.])
print h.GetQuantiles(1,q,prob)

But this is returning 1, regardless of what my histogram is, am I doing something wrong?

many thanks!

TH1::GetQuantiles

Hi! I based my example on it, but I still don’t know how to compute a single value.

My example is not working, is there anything wrong there?

Thanks

The documentation Wile linked says that the return value of GetQuantiles is a single integer, the number of quantiles computed. In your example you want to print q (and maybe prob).

Thanks a lot! I thought that the function gives the quantile(s), but now it’s clear!