mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
refactor: unnecessary line in fit parameter detection removed.
Iterator variable renamed.
This commit is contained in:
parent
5255f87d7d
commit
90c9ce9c73
1 changed files with 4 additions and 4 deletions
|
@ -216,9 +216,9 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
||||||
raise TypeError('func (key=' + key + ') is not a function.')
|
raise TypeError('func (key=' + key + ') is not a function.')
|
||||||
if np.asarray(xd[key]).shape[-1] != len(yd[key]):
|
if np.asarray(xd[key]).shape[-1] != len(yd[key]):
|
||||||
raise ValueError('x and y input (key=' + key + ') do not have the same length')
|
raise ValueError('x and y input (key=' + key + ') do not have the same length')
|
||||||
for i in range(100):
|
for n_loc in range(100):
|
||||||
try:
|
try:
|
||||||
funcd[key](np.arange(i), x_all.T[0])
|
funcd[key](np.arange(n_loc), x_all.T[0])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
continue
|
continue
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
@ -227,8 +227,8 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Fit function (key=" + key + ") is not valid.")
|
raise RuntimeError("Fit function (key=" + key + ") is not valid.")
|
||||||
n_parms = i
|
n_parms_ls.append(n_loc)
|
||||||
n_parms_ls.append(n_parms)
|
|
||||||
n_parms = max(n_parms_ls)
|
n_parms = max(n_parms_ls)
|
||||||
if not silent:
|
if not silent:
|
||||||
print('Fit with', n_parms, 'parameter' + 's' * (n_parms > 1))
|
print('Fit with', n_parms, 'parameter' + 's' * (n_parms > 1))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue