1
0
forked from IPKM/nmreval

deal with missing weight key get_state and set_state; partly fixes #158

This commit is contained in:
Dominik Demuth 2023-11-29 08:11:14 +00:00
parent 8a6c909c3e
commit 7c71061877

View File

@ -393,8 +393,7 @@ class FitResult(Points):
def get_state(self):
state = super().get_state()
for attr in ['idx', 'fun_kwargs', 'nobs', 'nvar',
'islog', 'iscomplex', 'x_data', 'y_data']:
for attr in ['idx', 'fun_kwargs', 'nobs', 'nvar', 'we', 'islog', 'iscomplex', 'x_data', 'y_data']:
state[attr] = getattr(self, attr)
state['name'] = self._model_name
@ -412,6 +411,8 @@ class FitResult(Points):
@staticmethod
def set_state(state, **kwargs):
state['params'] = {k: Parameter.set_state(v) for k, v in state.pop('params').items()}
if 'we' not in state:
state['we'] = '?'
data = FitResult(**state)
return data
@ -440,6 +441,9 @@ class FitResult(Points):
return new_fit
def sub(self, x_values):
if self.func is None:
raise ValueError('no fit function available to calculate new y values')
part_functions = []
actual_mode = -1
if 'complex_mode' in self.fun_kwargs: