make final fit parameter values

This commit is contained in:
Dominik Demuth 2023-09-19 12:34:44 +02:00
parent 067857eda2
commit 6ecc4a4126
2 changed files with 9 additions and 4 deletions

View File

@ -186,7 +186,6 @@ class Parameter:
@property @property
def value(self) -> float | None: def value(self) -> float | None:
# TODO first _value, then _expr
if self._value is not None: if self._value is not None:
return self._value return self._value
@ -239,3 +238,7 @@ class Parameter:
return para_copy return para_copy
def fix(self):
self._value = self.value
self.namespace = {}

View File

@ -187,7 +187,7 @@ class FitResult(Points):
nice_name = m.group(1) nice_name = m.group(1)
if func_number in split_funcs: if func_number in split_funcs:
nice_func = split_funcs[func_number] nice_func = split_funcs[func_number]
pvalue.fix()
pvalue.name = nice_name pvalue.name = nice_name
pvalue.function = nice_func pvalue.function = nice_func
parameter_dic[pname] = pvalue parameter_dic[pname] = pvalue
@ -196,6 +196,8 @@ class FitResult(Points):
if modelname[0] == '(' and modelname[-1] == ')': if modelname[0] == '(' and modelname[-1] == ')':
modelname = modelname[1:-1] modelname = modelname[1:-1]
print(parameter_dic)
return parameter_dic, modelname return parameter_dic, modelname
@property @property
@ -233,9 +235,9 @@ class FitResult(Points):
s.write(self.parameter_string()) s.write(self.parameter_string())
if statistics: if statistics:
s.write('Statistics\n') s.write('\nStatistics\n')
for k, v in self.statistics.items(): for k, v in self.statistics.items():
s.write(f' {k} : {v:.4f}') s.write(f' {k} : {v:.4f}\n')
if correlations and self.correlation is not None: if correlations and self.correlation is not None:
s.write('\nCorrelation (partial corr.)\n') s.write('\nCorrelation (partial corr.)\n')