From 361eebe3bf1fe6fd4d1632fdcaff22ec3fc96e3f Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Thu, 14 Nov 2024 13:27:25 +0100 Subject: [PATCH] Add missing swap_axes implementation in preview friend --- src/calng/preview_utils.py | 4 ++- src/calng/scenes.py | 51 ++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/calng/preview_utils.py b/src/calng/preview_utils.py index 12cb7e18..4b82d15e 100644 --- a/src/calng/preview_utils.py +++ b/src/calng/preview_utils.py @@ -261,6 +261,8 @@ class PreviewFriend: ) elif not inplace: data = data.copy() + if spec.swap_axes: + data = np.swapaxes(data, -1, -2) if spec.flip_ss: data = np.flip(data, -2) if spec.flip_fs: @@ -322,7 +324,7 @@ class PreviewFriend: if subconf.has("flipFS"): spec.flip_fs = subconf["flipFS"] if subconf.has("swapAxes"): - spec.flip_fs = subconf["flipFS"] + spec.swap_axes = subconf["swapAxes"] if subconf.has("replaceNanWith"): spec.nan_replacement = subconf["replaceNanWith"] diff --git a/src/calng/scenes.py b/src/calng/scenes.py index 6dd86d02..cfc1e76b 100644 --- a/src/calng/scenes.py +++ b/src/calng/scenes.py @@ -541,35 +541,44 @@ class RoiBox(VerticalLayout): class PreviewSettings(HorizontalLayout): def __init__(self, device_id, schema_hash, node_name): super().__init__() - tweaks = VerticalLayout( + tweaks = [ EditableRow( device_id, schema_hash, f"{node_name}.replaceNanWith", 6, 4, - ), - ) + ) + ] + flips = [] if schema_hash.has(f"{node_name}.flipSS"): - tweaks.children.append( - HorizontalLayout( - EditableRow( - device_id, - schema_hash, - f"{node_name}.flipSS", - 3, - 2, - ), - EditableRow( - device_id, - schema_hash, - f"{node_name}.flipFS", - 3, - 2, - ), - padding=0, + tweaks.append( + EditableRow( + device_id, + schema_hash, + f"{node_name}.swapAxes", + 6, + 4, ) ) + flips.append( + EditableRow( + device_id, + schema_hash, + f"{node_name}.flipSS", + 3, + 2, + ) + ) + flips.append( + EditableRow( + device_id, + schema_hash, + f"{node_name}.flipFS", + 3, + 2, + ) + ) downsampling = VerticalLayout( LabelModel( text="Downsampling", @@ -593,7 +602,7 @@ class PreviewSettings(HorizontalLayout): ) self.children.extend( [ - tweaks, + VerticalLayout(children=tweaks + [HorizontalLayout(children=flips)]), Vline(height=3 * BASE_INC), downsampling, ] -- GitLab