mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
remove keyword n_parms from fit standard
This commit is contained in:
parent
090a26919b
commit
960fc521c4
1 changed files with 9 additions and 12 deletions
|
@ -14,7 +14,7 @@ from autograd import elementwise_grad as egrad
|
||||||
from .pyerrors import Obs, derived_observable, covariance, pseudo_Obs
|
from .pyerrors import Obs, derived_observable, covariance, pseudo_Obs
|
||||||
|
|
||||||
|
|
||||||
def standard_fit(x, y, func,n_parms="auto", silent=False, **kwargs):
|
def standard_fit(x, y, func, silent=False, **kwargs):
|
||||||
"""Performs a non-linear fit to y = func(x) and returns a list of Obs corresponding to the fit parameters.
|
"""Performs a non-linear fit to y = func(x) and returns a list of Obs corresponding to the fit parameters.
|
||||||
|
|
||||||
x has to be a list of floats.
|
x has to be a list of floats.
|
||||||
|
@ -68,19 +68,16 @@ def standard_fit(x, y, func,n_parms="auto", silent=False, **kwargs):
|
||||||
if not callable(func):
|
if not callable(func):
|
||||||
raise TypeError('func has to be a function.')
|
raise TypeError('func has to be a function.')
|
||||||
|
|
||||||
if n_parms=="auto":
|
for i in range(25):
|
||||||
for i in range(25):
|
try:
|
||||||
try:
|
func(np.arange(i), x.T[0])
|
||||||
func(np.arange(i), x.T[0])
|
except:
|
||||||
except:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
break
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
n_parms = i
|
n_parms = i
|
||||||
|
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
print('Fit with', n_parms, 'parameters')
|
print('Fit with', n_parms, 'parameters')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue