mirror of
https://github.com/fjosw/pyerrors.git
synced 2026-02-28 15:53:38 +01:00
[Fix] Fix behaviour for rank deficient fits. Add test
This commit is contained in:
parent
46d32683d3
commit
18a70fad53
2 changed files with 25 additions and 2 deletions
|
|
@ -468,6 +468,19 @@ def test_total_least_squares():
|
|||
assert((outc.fit_parameters[1] - betac[1]).is_zero())
|
||||
|
||||
|
||||
def test_total_least_squares_vanishing_chisquare():
|
||||
"""Test that a saturated fit (n_obs == n_parms) works without exception."""
|
||||
def func(a, x):
|
||||
return a[0] + a[1] * x
|
||||
|
||||
x = [pe.pseudo_Obs(1.0, 0.1, 'x0'), pe.pseudo_Obs(2.0, 0.1, 'x1')]
|
||||
y = [pe.pseudo_Obs(1.0, 0.1, 'y0'), pe.pseudo_Obs(2.0, 0.1, 'y1')]
|
||||
|
||||
with pytest.warns(RuntimeWarning, match="rank deficient"):
|
||||
out = pe.total_least_squares(x, y, func, silent=True)
|
||||
assert len(out.fit_parameters) == 2
|
||||
|
||||
|
||||
def test_odr_derivatives():
|
||||
x = []
|
||||
y = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue