forked from IPKM/nmreval
Make FitResults from all fixed parameters; closes #151
This commit is contained in:
parent
12726e6f56
commit
aa0d14a322
@ -227,6 +227,8 @@ class FitRoutine(object):
|
||||
if mode is None:
|
||||
mode = self.fitmethod
|
||||
|
||||
print('run')
|
||||
|
||||
fit_groups, linked_parameter = self.prepare_links()
|
||||
for data_groups in fit_groups:
|
||||
if len(data_groups) == 1 and not self.linked:
|
||||
@ -234,6 +236,8 @@ class FitRoutine(object):
|
||||
# get variable parameter for fitter
|
||||
p0_k, lb_k, ub_k, var_pars_k = self._prep_data(data)
|
||||
|
||||
print(p0_k, var_pars_k)
|
||||
|
||||
if mode == 'lsq':
|
||||
self._least_squares_single(data, p0_k, lb_k, ub_k, var_pars_k)
|
||||
|
||||
@ -248,6 +252,7 @@ class FitRoutine(object):
|
||||
data_pars, p0, lb, ub, var_pars = self._prep_global(data_groups, linked_parameter)
|
||||
|
||||
if mode == 'lsq':
|
||||
print(data_pars, p0,var_pars)
|
||||
self._least_squares_global(data_groups, p0, lb, ub, var_pars, data_pars)
|
||||
|
||||
elif mode == 'nm':
|
||||
@ -287,8 +292,8 @@ class FitRoutine(object):
|
||||
vals = []
|
||||
var_pars = []
|
||||
for p_k, v_k in parameter.items():
|
||||
vals.append([v_k.scaled_value, v_k.lb / v_k.scale, v_k.ub / v_k.scale])
|
||||
if v_k.var:
|
||||
vals.append([v_k.scaled_value, v_k.lb / v_k.scale, v_k.ub / v_k.scale])
|
||||
var_pars.append(p_k)
|
||||
|
||||
pp, lb, ub = zip(*vals)
|
||||
@ -318,10 +323,10 @@ class FitRoutine(object):
|
||||
|
||||
actual_pars.append(p_k_used)
|
||||
# parameter is variable and was not found before as shared parameter
|
||||
p0.append(v_k_used.scaled_value)
|
||||
lb.append(v_k_used.lb / v_k_used.scale)
|
||||
ub.append(v_k_used.ub / v_k_used.scale)
|
||||
if v_k_used.var and p_k_used not in var:
|
||||
p0.append(v_k_used.scaled_value)
|
||||
lb.append(v_k_used.lb / v_k_used.scale)
|
||||
ub.append(v_k_used.ub / v_k_used.scale)
|
||||
var.append(p_k_used)
|
||||
|
||||
data_pars.append(actual_pars)
|
||||
@ -472,7 +477,7 @@ class FitRoutine(object):
|
||||
pass
|
||||
|
||||
# reshape the correlation matrices
|
||||
if corr is None:
|
||||
if corr is None or not corr_idx:
|
||||
actual_corr = None
|
||||
actual_pcorr = None
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user