mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
tests: num_grad test for total least squares added.
This commit is contained in:
parent
58b8383c1a
commit
e4d18fc8c8
1 changed files with 15 additions and 1 deletions
|
@ -83,7 +83,7 @@ def test_least_squares():
|
|||
assert math.isclose(pcov[i, i], betac[i].dvalue ** 2, abs_tol=1e-3)
|
||||
|
||||
|
||||
def test_fit_num_grad():
|
||||
def test_least_squares_num_grad():
|
||||
x = []
|
||||
y = []
|
||||
for i in range(2, 5):
|
||||
|
@ -97,6 +97,20 @@ def test_fit_num_grad():
|
|||
assert(num[1] == auto[1])
|
||||
|
||||
|
||||
def test_total_least_squares_num_grad():
|
||||
x = []
|
||||
y = []
|
||||
for i in range(2, 5):
|
||||
x.append(pe.pseudo_Obs(i * 0.01, 0.0001, "ens"))
|
||||
y.append(pe.pseudo_Obs(i * 0.01, 0.0001, "ens"))
|
||||
|
||||
num = pe.fits.total_least_squares(x, y, lambda a, x: np.exp(a[0] * x) + a[1], num_grad=True)
|
||||
auto = pe.fits.total_least_squares(x, y, lambda a, x: anp.exp(a[0] * x) + a[1], num_grad=False)
|
||||
|
||||
assert(num[0] == auto[0])
|
||||
assert(num[1] == auto[1])
|
||||
|
||||
|
||||
def test_alternative_solvers():
|
||||
dim = 92
|
||||
x = np.arange(dim)
|
||||
|
|
Loading…
Add table
Reference in a new issue