From 00385abbf98add7945af170b292774d377473a70 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:33:35 +0200 Subject: [PATCH] fix: rotation always counter-clockwise --- bec_widgets/examples/eiger_plot/eiger_plot.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/bec_widgets/examples/eiger_plot/eiger_plot.py b/bec_widgets/examples/eiger_plot/eiger_plot.py index 9636b3cf..e5cf1c62 100644 --- a/bec_widgets/examples/eiger_plot/eiger_plot.py +++ b/bec_widgets/examples/eiger_plot/eiger_plot.py @@ -75,18 +75,13 @@ class EigerPlot(QWidget): self.hist_levels[1] + 0.1 * self.hist_levels[1], ) - def rotate_data(self, data, k: int = 0, direction: int = 0) -> np.ndarray: + def rotate_data(self, data, k: int = 0) -> np.ndarray: """Rotate image by 90 degrees k times. Args: k(int): Number of times to rotate image by 90 degrees. - direction(int): 0 for clockwise, 1 for counter-clockwise """ - - if direction == 0: - data = np.rot90(self.image, k=k, axes=(1, 0)) - else: - data = np.rot90(self.image, k=k, axes=(0, 1)) + data = np.rot90(data, k=k, axes=(0, 1)) return data @@ -98,11 +93,7 @@ class EigerPlot(QWidget): if self.comboBox_rotation.currentIndex() == 0: # non rotated image self.imageItem.setImage(self.image, autoLevels=False) else: # rotated image - self.image = self.rotate_data( - data=self.image, - k=self.comboBox_rotation.currentIndex(), - direction=self.comboBox_direction.currentIndex(), - ) + self.image = self.rotate_data(data=self.image, k=self.comboBox_rotation.currentIndex()) self.imageItem.setImage(self.image, autoLevels=False)