1
0
forked from IPKM/nmreval

save original expression

This commit is contained in:
Dominik Demuth 2023-08-04 17:58:48 +02:00
parent c601e77cec
commit 7762758958

View File

@ -116,8 +116,10 @@ class Parameter:
self.namespace = None self.namespace = None
self.eval_allowed = True self.eval_allowed = True
self._expr = None self._expr = None
self._expr_disp = None
if isinstance(value, str): if isinstance(value, str):
self._expr_disp = value
value = _prepare_namespace_string(value) value = _prepare_namespace_string(value)
self._expr = value self._expr = value
self.var = False self.var = False
@ -152,7 +154,7 @@ class Parameter:
if self._expr is None: if self._expr is None:
ret_string += ' (fixed)' ret_string += ' (fixed)'
else: else:
ret_string += f' (calc: {self._expr})' ret_string += f' (calc: {self._expr_disp})'
return ret_string return ret_string
@ -213,7 +215,7 @@ class Parameter:
def copy(self) -> Parameter: def copy(self) -> Parameter:
if self._expr: if self._expr:
val = self._expr val = self._expr_disp
else: else:
val = self._value val = self._value
para_copy = Parameter(name=self.name, value=val, var=self.var, lb=self.lb, ub=self.ub) para_copy = Parameter(name=self.name, value=val, var=self.var, lb=self.lb, ub=self.ub)