From 5116622e42002fad31d1e4b6f9f96670288159b7 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 1 Nov 2023 18:33:52 +0100 Subject: [PATCH] fixed fit parameter ignore boundary problems; fixes #128 --- src/gui_qt/fit/fit_parameter.py | 2 +- src/nmreval/fit/parameter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui_qt/fit/fit_parameter.py b/src/gui_qt/fit/fit_parameter.py index 30b4b31..d0924a8 100644 --- a/src/gui_qt/fit/fit_parameter.py +++ b/src/gui_qt/fit/fit_parameter.py @@ -243,7 +243,7 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit): else: lb, ub = bds[i] try: - if not (lb < p_i < ub): + if not ((lb < p_i < ub) or (not is_fixed[i])): raise ValueError(f'Parameter {g.name} is outside bounds ({lb}, {ub})') except TypeError: pass diff --git a/src/nmreval/fit/parameter.py b/src/nmreval/fit/parameter.py index 2aaeb0b..65a320b 100644 --- a/src/nmreval/fit/parameter.py +++ b/src/nmreval/fit/parameter.py @@ -222,7 +222,7 @@ class Parameter: self.var = False else: if isinstance(self.lb, (int, float)) and isinstance(self.ub, (int, float)): - if self.lb <= value <= self.ub: + if (self.lb <= value <= self.ub) or (not self.var): self._value = value else: raise ValueError('Value of parameter is outside bounds')