bugs: fit display did not work when not all functions are checked; FC calc_relax changed x axis

This commit is contained in:
dominik 2022-07-28 20:20:49 +02:00
parent 16ccc3eb3d
commit 9aab28d593
3 changed files with 9 additions and 7 deletions

View File

@ -23,8 +23,7 @@ class LogGaussian(Distribution):
bounds = [(0, 10)]
@staticmethod
def distribution(tau, tau0, *args):
sigma = args[0]
def distribution(tau, tau0, sigma: float):
return np.exp(-0.5*(np.log(tau/tau0)/sigma)**2)/np.sqrt(2*np.pi)/sigma
@staticmethod

View File

@ -82,7 +82,9 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
self._current_function = None
else:
self._current_function = self.functionwidget.use_combobox.currentData()
f_tree = self.functionwidget.functree
func_idx = f_tree.currentItem().data(0, f_tree.counterRole)
self._current_function = self.functionwidget.functions[func_idx]
@QtCore.pyqtSlot(int)
def show_function_parameter(self, function_id: int, function_idx: int = None):
@ -457,9 +459,10 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
def set_parameter_iter(self, fit_id: str | None, param: List[float], functions: List, cnt: int = 0):
for model_p in functions:
cnt += self.param_widgets[model_p['cnt']].set_parameter(fit_id, param[cnt:])
if model_p['children']:
cnt += self.set_parameter_iter(fit_id, param, model_p['children'], cnt=cnt)
if model_p['active']:
cnt += self.param_widgets[model_p['cnt']].set_parameter(fit_id, param[cnt:])
if model_p['children']:
cnt += self.set_parameter_iter(fit_id, param, model_p['children'], cnt=cnt)
return cnt

View File

@ -25,7 +25,7 @@ class _AbstractFC:
def _calc_relax(cls, x, c, *args, xaxis='freq', yaxis='chi', is_bpp=True, **kwargs):
_x = x
if xaxis == 'freq':
_x *= 2*np.pi
_x = 2*np.pi * x
if is_bpp:
r1 = cls.relax.t1(_x, *args, prefactor=c, inverse=False)