forked from IPKM/nmreval
closes #80; evaluate expression an Datensätzen mit gehiddenen Values
This commit is contained in:
parent
6e976e1404
commit
f934104587
@ -459,7 +459,7 @@ class ExperimentContainer(QtCore.QObject):
|
||||
return 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:
|
||||
namespace.update({"fit['%s']" % (convert(pname, old='tex', new='str')): pvalue.value
|
||||
@ -474,7 +474,7 @@ class ExperimentContainer(QtCore.QObject):
|
||||
if c:
|
||||
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']
|
||||
|
||||
return new_data
|
||||
|
@ -483,15 +483,17 @@ class Points:
|
||||
|
||||
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:
|
||||
x = self._x
|
||||
if y is None:
|
||||
y = self._y
|
||||
if y_err is not None:
|
||||
if y_err is None:
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user