mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2025-05-17 05:19:24 +02:00
ZH: figlib: stabilise chisquare calculation
This commit is contained in:
parent
80cc240f23
commit
581b83ac5b
2 changed files with 7 additions and 1 deletions
|
@ -245,6 +245,8 @@ def fitted_histogram_figure(
|
|||
chisq_strs = []
|
||||
if calc_chisq and cdf:
|
||||
ct = np.diff(cdf(bins, *fit_params))*np.sum(counts)
|
||||
if True: # stabilise the chisquare derivation
|
||||
ct *= np.sum(counts)/np.sum(ct)
|
||||
c2t = stats.chisquare(counts, ct, ddof=len(fit_params))
|
||||
chisq_strs = [
|
||||
f"$\\chi^2$/dof = {c2t[0]: .2g}/{len(fit_params)}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue