From 86f641d01c87a1faabae651830c3ac7fa9c9c88e Mon Sep 17 00:00:00 2001 From: mlauer154 Date: Mon, 12 Feb 2024 16:37:43 -0600 Subject: [PATCH] Now allowing lower and upper bounds of angle parameters to be any value in the range -inf to +inf --- pymead/core/param.py | 6 ------ pymead/gui/bounds_values_table.py | 2 +- pymead/gui/parameter_tree.py | 12 ++---------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/pymead/core/param.py b/pymead/core/param.py index 66cad827..a7cb292f 100644 --- a/pymead/core/param.py +++ b/pymead/core/param.py @@ -352,15 +352,9 @@ def rad(self): return self._value def set_lower(self, lower: float): - if lower < 0.0: - lower = 0.0 - return super().set_lower(UNITS.convert_angle_to_base(lower, self.unit())) def set_upper(self, upper: float): - if upper > UNITS.convert_angle_from_base(2 * np.pi, self.unit()): - upper = UNITS.convert_angle_from_base(2 * np.pi, self.unit()) - return super().set_upper(UNITS.convert_angle_to_base(upper, self.unit())) def set_value(self, value: float, updated_objs: typing.List[PymeadObj] = None, bounds_normalized: bool = False): diff --git a/pymead/gui/bounds_values_table.py b/pymead/gui/bounds_values_table.py index 62baf240..f147a2e1 100644 --- a/pymead/gui/bounds_values_table.py +++ b/pymead/gui/bounds_values_table.py @@ -29,7 +29,7 @@ def handleItemChanged(self, item): dv = self.geo_col.container()["desvar"][self.item(item.row(), 0).data(0)] # Check if the string input is castable to a float. If not, set the float_val to None - if item.data(0).strip().replace(".", "").isnumeric(): + if item.data(0).strip().replace(".", "").replace("-", "").isnumeric(): float_val = float(item.data(0).strip()) else: float_val = None diff --git a/pymead/gui/parameter_tree.py b/pymead/gui/parameter_tree.py index ed0fafe5..ea3ae907 100644 --- a/pymead/gui/parameter_tree.py +++ b/pymead/gui/parameter_tree.py @@ -174,16 +174,8 @@ def __init__(self, parent, param: Param): self.setDecimals(6) self.setSingleStep(0.01) self.param = param - if (isinstance(param, LengthParam) and self.param.point is None) or isinstance(param, AngleParam): - self.setMinimum(0.0) - else: - self.setMinimum(-1e9) - - if isinstance(param, AngleParam): - self.setMaximum(UNITS.convert_angle_to_base(2 * np.pi, self.param.unit())) - else: - self.setMaximum(1e9) - + self.setMinimum(-1e9) + self.setMaximum(1e9) self.setValue(self.param.lower()) self.valueChanged.connect(self.onValueChanged)