mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 11:33:42 +02:00
fix: bug in estimation of chisquare for correlated fit fixed, tests
added.
This commit is contained in:
parent
ff5540d667
commit
e7f5961cd6
2 changed files with 9 additions and 1 deletions
|
@ -149,8 +149,10 @@ def test_correlated_fit():
|
|||
return p[1] * anp.exp(-p[0] * x)
|
||||
|
||||
fitp = pe.least_squares(x, data, fitf, expected_chisquare=True)
|
||||
assert np.isclose(fitp.chisquare / fitp.dof, fitp.chisquare_by_dof, atol=1e-14)
|
||||
|
||||
fitpc = pe.least_squares(x, data, fitf, correlated_fit=True)
|
||||
assert np.isclose(fitpc.chisquare / fitpc.dof, fitpc.chisquare_by_dof, atol=1e-14)
|
||||
for i in range(2):
|
||||
diff = fitp[i] - fitpc[i]
|
||||
diff.gamma_method()
|
||||
|
@ -176,6 +178,8 @@ def test_fit_corr_independent():
|
|||
out_corr = pe.least_squares(x, oy, func, correlated_fit=True, method=method)
|
||||
|
||||
assert np.isclose(out.chisquare, out_corr.chisquare)
|
||||
assert np.isclose(out.dof, out_corr.dof)
|
||||
assert np.isclose(out.chisquare_by_dof, out_corr.chisquare_by_dof)
|
||||
assert (out[0] - out_corr[0]).is_zero(atol=1e-5)
|
||||
assert (out[1] - out_corr[1]).is_zero(atol=1e-5)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue