move shift/scale to container; closes #102
This commit is contained in:
parent
13e6112c99
commit
becc1a15a9
@ -463,6 +463,16 @@ class ExperimentContainer(QtCore.QObject):
|
|||||||
|
|
||||||
return offset
|
return offset
|
||||||
|
|
||||||
|
@plot_update
|
||||||
|
def shift_scale(self, shift_factor: tuple[float, float], scaling_factor: tuple[float, float]):
|
||||||
|
scale_x, scale_y = scaling_factor
|
||||||
|
shift_x, shift_y = shift_factor
|
||||||
|
self.data.x = self.data.x * scale_x + shift_x
|
||||||
|
self.data.y = self.data.y * scale_y + shift_y
|
||||||
|
self.data.y_err = self.data.y_err * scale_y
|
||||||
|
|
||||||
|
self.update({'shift': scaling_factor, 'scale': shift_factor})
|
||||||
|
|
||||||
def get_namespace(self, i: int = None, j: int = None) -> dict:
|
def get_namespace(self, i: int = None, j: int = None) -> dict:
|
||||||
if (i is None) and (j is None):
|
if (i is None) and (j is None):
|
||||||
prefix = ''
|
prefix = ''
|
||||||
|
@ -841,13 +841,10 @@ class UpperManagement(QtCore.QObject):
|
|||||||
d_k = self.data[k]
|
d_k = self.data[k]
|
||||||
|
|
||||||
if copy_data is None:
|
if copy_data is None:
|
||||||
d_k.x = d_k.x*v[1][0] + v[0][0]
|
d_k.shift_scale(v[0], v[1])
|
||||||
d_k.y = d_k.y*v[1][1] + v[0][1]
|
|
||||||
else:
|
else:
|
||||||
new_data = d_k.copy(full=True)
|
new_data = d_k.copy(full=True)
|
||||||
new_data.update({'shift': v[0], 'scale': v[1]})
|
new_data.shift_scale(v[0], v[1])
|
||||||
new_data.data.x = new_data.x*v[1][0] + v[0][0]
|
|
||||||
new_data.y = new_data.y*v[1][1] + v[0][1]
|
|
||||||
|
|
||||||
sid = self.add(new_data)
|
sid = self.add(new_data)
|
||||||
sid_list.append(sid)
|
sid_list.append(sid)
|
||||||
|
Loading…
Reference in New Issue
Block a user