From 03e6cf3451b2a86404bf5ce4d26b6161bdb48aad Mon Sep 17 00:00:00 2001 From: x12sa Date: Wed, 4 Mar 2026 14:18:13 +0100 Subject: [PATCH] WIP gui final touch --- .../plugins/flomni/gui_tools.py | 15 ++++---------- .../bec_widgets/widgets/xray_eye/x_ray_eye.py | 20 +++++++++++++------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py index 47a774a..8dd2c38 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py @@ -179,18 +179,11 @@ class flomniGuiTools: self.flomnigui_remove_all_docks() # Add a new dock with a RingProgressBar widget self.progressbar = self.gui.flomni.new("RingProgressBar") - # # Disable automatic updates and manually set the self.progressbar value - # self.progressbar.enable_auto_updates(False) - # Set precision for the self.progressbar display - # self.progressbar.set_precision(1) # Display self.progressbar with one decimal places + # Setting multiple rings with different values self.progressbar.add_ring().set_update("manual") self.progressbar.add_ring().set_update("manual") self.progressbar.add_ring().set_update("scan") - # Set the values of the rings to 50, 75, and 25 from outer to inner ring - # self.progressbar.set_value([50, 75]) - # Add a new dock with a TextBox widget - self.text_box = self.gui.flomni.new("TextBox") self._flomnigui_update_progress() @@ -206,9 +199,9 @@ class flomniGuiTools: ) main_progress_ring.set_value(progress) subtomo_progress_ring.set_value(subtomo_progress) - if self.text_box is not None: - text = f"Progress report:\n Tomo type: ....................... {self.progress['tomo_type']}\n Projection: ...................... {self.progress['projection']:.0f}\n Total projections expected ....... {self.progress['total_projections']}\n Angle: ........................... {self.progress['angle']}\n Current subtomo: ................. {self.progress['subtomo']}\n Current projection within subtomo: {self.progress['subtomo_projection']}\n Total projections per subtomo: ... {self.progress['subtomo_total_projections']}" - self.text_box.set_plain_text(text) + + text = f"Progress report:\n Tomo type: ....................... {self.progress['tomo_type']}\n Projection: ...................... {self.progress['projection']:.0f}\n Total projections expected ....... {self.progress['total_projections']}\n Angle: ........................... {self.progress['angle']}\n Current subtomo: ................. {self.progress['subtomo']}\n Current projection within subtomo: {self.progress['subtomo_projection']}\n Total projections per subtomo: ... {self.progress['subtomo_total_projections']}" + self.progressbar.set_center_label(text) if __name__ == "__main__": diff --git a/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py b/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py index 6bfbd51..1225b06 100644 --- a/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py +++ b/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py @@ -288,13 +288,20 @@ class XRayEye(BECWidget, QWidget): x=[0], y=[1], label="fit-x", - dap="SineModel", - dap_parameters={ - "frequency": {"value": 0.0174533, "vary": False, "min": 0.01, "max": 0.02} - }, + dap=["SineModel","LinearModel"], + dap_parameters=[ + {"frequency": {"value": 0.0174533, "vary": False, "min": 0.01, "max": 0.02}},{"slope": {"value": 0, "vary": False, "min": 0.0, "max": 0.02}}], + dap_oversample=5, + ) + self.waveform_y.plot( + x=[0], + y=[2], + label="fit-y", + dap=["SineModel","LinearModel"], + dap_parameters=[ + {"frequency": {"value": 0.0174533, "vary": False, "min": 0.01, "max": 0.02}},{"slope": {"value": 0, "vary": False, "min": 0.0, "max": 0.02}}], dap_oversample=5, ) - self.waveform_y.plot(x=[0], y=[2], label="fit-y", dap="SineModel") # ,dap_oversample=5) self.fit_x = self.waveform_x.curves[0] self.fit_y = self.waveform_y.curves[0] @@ -484,7 +491,7 @@ class XRayEye(BECWidget, QWidget): # self.bec_dispatcher.disconnect_slot(self.device_updates, MessageEndpoints.device_readback("omny_xray_gui")) curve_id = meta.get("curve_id") - if curve_id == "fit-x-SineModel": + if curve_id == "fit-x-SineModel+LinearModel": self.dev.omny_xray_gui.fit_params_x.set(data).wait() print(f"setting x data to {data}") else: @@ -504,6 +511,7 @@ class XRayEye(BECWidget, QWidget): # self.fix_x.title = " got fit array" print(f"got fit array {fit_array}") self.waveform_x.curves[0].set_data(x=fit_array[0], y=fit_array[1]) + self.waveform_y.curves[0].set_data(x=fit_array[0], y=fit_array[2]) # self.fit_x.set_data(x=fit_array[0],y=fit_array[1]) # self.fit_y.set_data(x=fit_array[0],y=fit_array[2])