1
0
forked from IPKM/nmreval

closes #80; evaluate expression an Datensätzen mit gehiddenen Values

This commit is contained in:
Dominik Demuth 2023-06-12 18:07:51 +02:00
parent 6e976e1404
commit f934104587
2 changed files with 7 additions and 5 deletions

View File

@ -459,7 +459,7 @@ class ExperimentContainer(QtCore.QObject):
return namespace return namespace
def eval_expression(self, cmds, namespace): def eval_expression(self, cmds, namespace):
namespace.update({'x': self.x, 'y': self.y, 'y_err': self.y_err, 'value': self.value}) namespace.update({'x': self._data.x, 'y': self._data.y, 'y_err': self._data.y_err, 'value': self.value})
if len(self._fits) == 1: if len(self._fits) == 1:
namespace.update({"fit['%s']" % (convert(pname, old='tex', new='str')): pvalue.value namespace.update({"fit['%s']" % (convert(pname, old='tex', new='str')): pvalue.value
@ -474,7 +474,7 @@ class ExperimentContainer(QtCore.QObject):
if c: if c:
exec(c, globals(), namespace) exec(c, globals(), namespace)
new_data.set_data(x=namespace['x'], y=namespace['y'], y_err=namespace['y_err']) new_data.set_data(x=namespace['x'], y=namespace['y'], y_err=namespace['y_err'], replace_mask=False)
new_data.value = namespace['value'] new_data.value = namespace['value']
return new_data return new_data

View File

@ -483,15 +483,17 @@ class Points:
return self return self
def set_data(self, x: np.ndarray = None, y: np.ndarray = None, y_err: np.ndarray = None) -> PointLike: def set_data(self, x: np.ndarray = None, y: np.ndarray = None, y_err: np.ndarray = None, replace_mask=True) -> PointLike:
if x is None: if x is None:
x = self._x x = self._x
if y is None: if y is None:
y = self._y y = self._y
if y_err is not None: if y_err is None:
y_err = self._y_err y_err = self._y_err
self._x, self._y, self._y_err, self.mask = self._prepare_xy(x, y, y_err) self._x, self._y, self._y_err, mask = self._prepare_xy(x, y, y_err)
if replace_mask:
self.mask = mask
return self return self