Parameter in preview

This commit is contained in:
Dominik Demuth 2023-09-18 15:30:06 +02:00
parent bd1a227e4c
commit 1d22f22901
2 changed files with 5 additions and 10 deletions

View File

@ -237,7 +237,7 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit):
for i, (p_i, g) in enumerate(zip(parameter, self.global_parameter)): for i, (p_i, g) in enumerate(zip(parameter, self.global_parameter)):
if isinstance(g, FitModelWidget): if isinstance(g, FitModelWidget):
if p_i is None: if (p_i is None) and (not is_global[i]):
# set has no oen value # set has no oen value
p.append(param_general[i].copy()) p.append(param_general[i].copy())
else: else:

View File

@ -9,6 +9,7 @@ import numpy as np
from pyqtgraph import mkPen from pyqtgraph import mkPen
from nmreval.fit._meta import MultiModel, ModelFactory from nmreval.fit._meta import MultiModel, ModelFactory
from nmreval.fit.data import Data
from nmreval.fit.model import Model from nmreval.fit.model import Model
from nmreval.fit.result import FitResult from nmreval.fit.result import FitResult
@ -419,20 +420,14 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
self.preview_lines = [] self.preview_lines = []
for k, model in models_parameters.items(): for k, model in models_parameters.items():
f = model['func'] f = Model(model['func'])
is_complex = self._complex[k] is_complex = self._complex[k]
parameters = model['parameter'] parameters = model['data_parameter']
color = model['color'] color = model['color']
seen_parameter = []
for p, kwargs in parameters.values(): for p, kwargs in parameters.values():
if (p, kwargs) in seen_parameter: print(pp.value for pp in p)
# plot only previews with different parameter
continue
seen_parameter.append((p, kwargs))
if is_complex is not None: if is_complex is not None:
y = f.func(x, *p, complex_mode=is_complex, **kwargs) y = f.func(x, *p, complex_mode=is_complex, **kwargs)