From f1dd299fad6e04edf3ee21910e8be123f70f9bf5 Mon Sep 17 00:00:00 2001 From: x01dc Date: Thu, 25 Sep 2025 16:42:40 +0200 Subject: [PATCH 1/3] gui tools running --- .../plugins/flomni/gui_tools.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 aef6ca3..2093b5d 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py @@ -44,7 +44,7 @@ class flomniGuiTools: self.flomnigui_remove_all_docks() self.camera_gripper_image = self.gui.flomni.new("camera_gripper").new("Image") if self._flomnicam_check_device_exists(dev.cam_flomni_gripper): - self.camera_gripper_image.image(("cam_flomni_gripper","preview")) + self.camera_gripper_image.image(("cam_flomni_gripper", "preview")) self.camera_gripper_image.lock_aspect_ratio = True self.camera_gripper_image.enable_fps_monitor = True self.camera_gripper_image.enable_toolbar = False @@ -55,7 +55,7 @@ class flomniGuiTools: print("Cannot open camera_gripper. Device does not exist.") self.camera_overview_image = self.gui.flomni.new("camera_overview").new("Image") if self._flomnicam_check_device_exists(dev.cam_flomni_overview): - self.camera_overview_image.image(("cam_flomni_overview","preview")) + self.camera_overview_image.image(("cam_flomni_overview", "preview")) self.camera_overview_image.lock_aspect_ratio = True self.camera_overview_image.enable_fps_monitor = True self.camera_overview_image.enable_toolbar = False @@ -81,13 +81,13 @@ class flomniGuiTools: self.flomnigui_remove_all_docks() self.idle_text_box = self.gui.flomni.new("idle_textbox").new("TextBox") text = ( - "
"                                       
+            "
"
             + " ,---.,--. ,-----. ,--.   ,--.,--.  ,--.,--. \n"
             + "/  .-'|  |'  .-.  '|   `.'   ||  ,'.|  ||  | \n"
             + "|  `-,|  ||  | |  ||  |'.'|  ||  |' '  ||  | \n"
             + "|  .-'|  |'  '-'  '|  |   |  ||  | `   ||  | \n"
             + "`--'  `--' `-----' `--'   `--'`--'  `--'`--' \n"
-            + "
" + + "
" ) self.idle_text_box.set_html_text(text) @@ -137,16 +137,14 @@ class flomniGuiTools: self.text_box.set_plain_text(text) - if __name__ == "__main__": - from bec_lib.client import BECClient + from bec_lib.client import BECClient from bec_widgets.cli.client_utils import BECGuiClient + client = BECClient() client.start() client.gui = BECGuiClient() - - flomni_gui = flomniGuiTools(client) flomni_gui.flomnigui_show_gui() - flomni_gui.flomnigui_show_progress() \ No newline at end of file + flomni_gui.flomnigui_show_progress() -- 2.49.1 From 1d9fb39c0e21c5aabf0b5dfaf161146eac07a091 Mon Sep 17 00:00:00 2001 From: x01dc Date: Fri, 10 Oct 2025 15:28:38 +0200 Subject: [PATCH 2/3] initial version flomni temp humidity --- csaxs_bec/device_configs/flomni_config.yaml | 32 ++++- .../devices/omny/flomni_temp_and_humidity.py | 116 ++++++++++++++++++ 2 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 csaxs_bec/devices/omny/flomni_temp_and_humidity.py diff --git a/csaxs_bec/device_configs/flomni_config.yaml b/csaxs_bec/device_configs/flomni_config.yaml index 24e9679..ab0b16f 100644 --- a/csaxs_bec/device_configs/flomni_config.yaml +++ b/csaxs_bec/device_configs/flomni_config.yaml @@ -365,7 +365,9 @@ rtz: readOnly: false readoutPriority: on_request - +############################################################ +####################### Cameras ############################ +############################################################ cam_flomni_gripper: description: Camera sample changer @@ -389,4 +391,30 @@ cam_flomni_overview: enabled: true onFailure: buffer readOnly: false - readoutPriority: on_request \ No newline at end of file + readoutPriority: on_request + +# cam_flomni_xeye: +# description: Camera flOMNI Xray eye ID101 +# deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera +# deviceConfig: +# camera_ID: 101 +# bits_per_pixel: 24 +# channels: 3 +# m_n_colormode: 1 +# enabled: true +# onFailure: buffer +# readOnly: false +# readoutPriority: async + + +# ############################################################ +# ################### flOMNI temperatures #################### +# ############################################################ +flomni_temphum: + description: flOMNI Temperatures and humidity + deviceClass: csaxs_bec.devices.omny.flomni_temp_and_humidity.FlomniTempHum + deviceConfig: {} + enabled: true + onFailure: buffer + readOnly: false + readoutPriority: baseline \ No newline at end of file diff --git a/csaxs_bec/devices/omny/flomni_temp_and_humidity.py b/csaxs_bec/devices/omny/flomni_temp_and_humidity.py new file mode 100644 index 0000000..498fc78 --- /dev/null +++ b/csaxs_bec/devices/omny/flomni_temp_and_humidity.py @@ -0,0 +1,116 @@ +import time +import datetime + +from ophyd import Component as Cpt +from ophyd import Device +from ophyd import DynamicDeviceComponent as Dcpt +from ophyd import EpicsSignal +from prettytable import FRAME, PrettyTable +import numpy as np + +class FlomniTempHumError(Exception): + pass + + +class FlomniTempHum(Device): + USER_ACCESS = [ + "show_all", + "help", + ] + SUB_VALUE = "value" + _default_sub = SUB_VALUE + + + temperature_mirror = Cpt( + EpicsSignal, name="temperature_mirror", read_pv="XOMNI-TEMPHUM-MIRROR:0.VAL" + ) + temperature_mirrorset_set = Cpt( + EpicsSignal, name="temperature_mirrorset_set", read_pv="XOMNI-TEMPHUM-MIRRORSET_SET:0.VAL" + ) + temperature_mirrorset_rb = Cpt( + EpicsSignal, name="temperature_mirrorset_rb", read_pv="XOMNI-TEMPHUM-MIRRORSET_RB:0.VAL" + ) + + temperature_osa = Cpt( + EpicsSignal, name="temperature_osa", read_pv="XOMNI-TEMPHUM-OSA:0.VAL" + ) + temperature_osaset_set = Cpt( + EpicsSignal, name="temperature_osaset_set", read_pv="XOMNI-TEMPHUM-OSASET_SET:0.VAL" + ) + temperature_osaset_rb = Cpt( + EpicsSignal, name="temperature_osaset_rb", read_pv="XOMNI-TEMPHUM-OSASET_RB:0.VAL" + ) + + omegactrl_alive = Cpt( + EpicsSignal, name="omegactrl_alive", read_pv="XOMNI-TEMPHUM-OMEGACTRL-ALIVE:0.VAL" + ) + galilctrl_alive = Cpt( + EpicsSignal, name="galilctrl_alive", read_pv="XOMNI-TEMPHUM-GALILCTRL-ALIVE:0.VAL" + ) + + temperature_heater = Cpt( + EpicsSignal, name="temperature_heater", read_pv="XOMNI-TEMPHUM-HEATER:0.VAL" + ) + temperature_heaterset_set = Cpt( + EpicsSignal, name="temperature_heaterset_set", read_pv="XOMNI-TEMPHUM-HEATERSET_SET:0.VAL" + ) + temperature_heaterset_rb = Cpt( + EpicsSignal, name="temperature_heaterset_rb", read_pv="XOMNI-TEMPHUM-HEATERSET_RB:0.VAL" + ) + temperature_heaterhousing = Cpt( + EpicsSignal, name="temperature_heaterhousing", read_pv="XOMNI-TEMPHUM-HEATERHOUSE:0.VAL" + ) + temperature_heaterhousing_alarm = Cpt( + EpicsSignal, name="temperature_heaterhousing_alarm", read_pv="XOMNI-TEMPHUM-HEATERHOUSEALARM:0.VAL" + ) + temperature_heater_enabled = Cpt( + EpicsSignal, name="temperature_heater_enabled", read_pv="XOMNI-TEMPHUM-HEAT_EN:0.VAL" + ) + + +# XOMNI-TEMPHUM-HUM1,0} +# {XOMNI-TEMPHUM-HUM2,0} +# {XOMNI-TEMPHUM-TEMP1,0} +# {XOMNI-TEMPHUM-TEMP2,0} +# {XOMNI-TEMPHUM-ERR1,0} +# {XOMNI-TEMPHUM-ERR2,0} +# {XOMNI-TEMPHUM-FLOW,0} +# {XOMNI-TEMPHUM-FLOWSET,0} +# {XOMNI-TEMPHUM-FLOWSETSET,0} +# {XOMNI-TEMPHUM-HUMSET,0} +# {XOMNI-TEMPHUM-HUMSETSET,0} +# {XOMNI-TEMPHUM-SUCTION,0} +# {XOMNI-TEMPHUM-SUCTIONSET,0} +# {XOMNI-TEMPHUM-VALVEDRY,0} +# {XOMNI-TEMPHUM-VALVEWET,0} +# {XOMNI-TEMPHUM-VALVESUC,0} +# {XOMNI-TEMPHUM-SETUPTEMP,0} +# } + + def __init__(self, prefix="", *, name, **kwargs): + super().__init__(prefix, name=name, **kwargs) + self.temperature_mirror.subscribe(self._emit_value, run=False) + + def _emit_value(self, **kwargs): + timestamp = kwargs.pop("timestamp", time.time()) + self._run_subs(sub_type=self.SUB_VALUE, timestamp=timestamp, obj=self) + + + + def show_all(self): + print("Temperatures in flOMNI") + print(f" Mirror: {float(self.temperature_mirror.get()):.2f} degC") + print(f" Mirror Setpoint: {float(self.temperature_mirrorset_rb.get()):.2f} degC") + print(f" OSA: {float(self.temperature_osa.get()):.1f} degC") + print(f" OSA Setpoint: {float(self.temperature_osaset_rb.get()):.1f} degC") + print(f" Heater: {float(self.temperature_heater.get()):.1f} degC") + print(f" Heater Setpoint: {float(self.temperature_heaterset_rb.get()):.1f} degC") + print(f" Heater Enabled: {float(self.temperature_heater_enabled.get()):.0f}") + print(f" Heater Housing: {float(self.temperature_heaterhousing.get()):.1f} degC") + print(f" Heater Housing Alarm: {float(self.temperature_heaterhousing_alarm.get()):.0f}") + print(f" OMEGA ALIVE: {float(self.temperature_heaterhousing_alarm.get()):.0f}") + + + + def help(self): + print("Help for OMNY temperatures:") -- 2.49.1 From 725eed17ed0a1ff40b347f82709c3029be0979a3 Mon Sep 17 00:00:00 2001 From: x01dc Date: Tue, 14 Oct 2025 11:30:22 +0200 Subject: [PATCH 3/3] finalized flomni temp and humidity display --- .../devices/omny/flomni_temp_and_humidity.py | 152 ++++++++++++++---- 1 file changed, 122 insertions(+), 30 deletions(-) diff --git a/csaxs_bec/devices/omny/flomni_temp_and_humidity.py b/csaxs_bec/devices/omny/flomni_temp_and_humidity.py index 498fc78..f22a698 100644 --- a/csaxs_bec/devices/omny/flomni_temp_and_humidity.py +++ b/csaxs_bec/devices/omny/flomni_temp_and_humidity.py @@ -66,26 +66,91 @@ class FlomniTempHum(Device): temperature_heater_enabled = Cpt( EpicsSignal, name="temperature_heater_enabled", read_pv="XOMNI-TEMPHUM-HEAT_EN:0.VAL" ) - -# XOMNI-TEMPHUM-HUM1,0} -# {XOMNI-TEMPHUM-HUM2,0} -# {XOMNI-TEMPHUM-TEMP1,0} -# {XOMNI-TEMPHUM-TEMP2,0} -# {XOMNI-TEMPHUM-ERR1,0} -# {XOMNI-TEMPHUM-ERR2,0} -# {XOMNI-TEMPHUM-FLOW,0} -# {XOMNI-TEMPHUM-FLOWSET,0} -# {XOMNI-TEMPHUM-FLOWSETSET,0} -# {XOMNI-TEMPHUM-HUMSET,0} -# {XOMNI-TEMPHUM-HUMSETSET,0} -# {XOMNI-TEMPHUM-SUCTION,0} -# {XOMNI-TEMPHUM-SUCTIONSET,0} -# {XOMNI-TEMPHUM-VALVEDRY,0} -# {XOMNI-TEMPHUM-VALVEWET,0} -# {XOMNI-TEMPHUM-VALVESUC,0} -# {XOMNI-TEMPHUM-SETUPTEMP,0} -# } + temperature_heater_enabled = Cpt( + EpicsSignal, name="temperature_heater_enabled", read_pv="XOMNI-TEMPHUM-HEAT_EN:0.VAL" + ) + +###### GALIL CONTROLLER + + + humidity_sensor1 = Cpt( + EpicsSignal, name="humidity_sensor1", read_pv="XOMNI-TEMPHUM-HUM1:0.VAL" + ) + + humidity_sensor2 = Cpt( + EpicsSignal, name="humidity_sensor2", read_pv="XOMNI-TEMPHUM-HUM2:0.VAL" + ) + + humidity_sensor1_temperature = Cpt( + EpicsSignal, name="humidity_sensor1_temperature", read_pv="XOMNI-TEMPHUM-TEMP1:0.VAL" + ) + + humidity_sensor2_temperature = Cpt( + EpicsSignal, name="humidity_sensor2_temperature", read_pv="XOMNI-TEMPHUM-TEMP2:0.VAL" + ) + + humidity_sensor1_err = Cpt( + EpicsSignal, name="humidity_sensor1_err", read_pv="XOMNI-TEMPHUM-ERR1:0.VAL" + ) + + humidity_sensor2_err = Cpt( + EpicsSignal, name="humidity_sensor2_err", read_pv="XOMNI-TEMPHUM-ERR2:0.VAL" + ) + + flow = Cpt( + EpicsSignal, name="flow", read_pv="XOMNI-TEMPHUM-FLOW:0.VAL" + ) + + flowset = Cpt( + EpicsSignal, name="flowset", read_pv="XOMNI-TEMPHUM-FLOWSET:0.VAL" + ) + + flowset_set = Cpt( + EpicsSignal, name="flowset_set", read_pv="XOMNI-TEMPHUM-FLOWSETSET:0.VAL" + ) + + humidityset = Cpt( + EpicsSignal, name="humidityset", read_pv="XOMNI-TEMPHUM-HUMSET:0.VAL" + ) + + humidityset_set = Cpt( + EpicsSignal, name="humidityset_set", read_pv="XOMNI-TEMPHUM-HUMSETSET:0.VAL" + ) + + suction = Cpt( + EpicsSignal, name="suction", read_pv="XOMNI-TEMPHUM-SUCTION:0.VAL" + ) + + valvedry = Cpt( + EpicsSignal, name="valvedry", read_pv="XOMNI-TEMPHUM-VALVEDRY:0.VAL" + ) + + valvewet = Cpt( + EpicsSignal, name="valvewet", read_pv="XOMNI-TEMPHUM-VALVEWET:0.VAL" + ) + + setuptemp = Cpt( + EpicsSignal, name="setuptemp", read_pv="XOMNI-TEMPHUM-SETUPTEMP:0.VAL" + ) + + + + def omega_controller_running(self): + time_diff = np.fabs(float(self.omegactrl_alive.get()) - time.time()) + if time_diff > 120: + return False + else: + return True + + def galil_controller_running(self): + time_diff = np.fabs(float(self.galilctrl_alive.get()) - time.time()) + if time_diff > 120: + return False + else: + return True + + def __init__(self, prefix="", *, name, **kwargs): super().__init__(prefix, name=name, **kwargs) @@ -98,19 +163,46 @@ class FlomniTempHum(Device): def show_all(self): - print("Temperatures in flOMNI") - print(f" Mirror: {float(self.temperature_mirror.get()):.2f} degC") - print(f" Mirror Setpoint: {float(self.temperature_mirrorset_rb.get()):.2f} degC") - print(f" OSA: {float(self.temperature_osa.get()):.1f} degC") - print(f" OSA Setpoint: {float(self.temperature_osaset_rb.get()):.1f} degC") - print(f" Heater: {float(self.temperature_heater.get()):.1f} degC") - print(f" Heater Setpoint: {float(self.temperature_heaterset_rb.get()):.1f} degC") + print("=== flOMNI Temperature & Humidity Overview ===") + print("") + print("Temperatures:") + print(f" Mirror: {float(self.temperature_mirror.get()):7.2f} °C") + print(f" Mirror Setpoint (RB): {float(self.temperature_mirrorset_rb.get()):7.2f} °C") + print(f" OSA: {float(self.temperature_osa.get()):7.2f} °C") + print(f" OSA Setpoint (RB): {float(self.temperature_osaset_rb.get()):7.2f} °C") + print(f" Heater: {float(self.temperature_heater.get()):7.2f} °C") + print(f" Heater Setpoint (RB): {float(self.temperature_heaterset_rb.get()):7.2f} °C") print(f" Heater Enabled: {float(self.temperature_heater_enabled.get()):.0f}") - print(f" Heater Housing: {float(self.temperature_heaterhousing.get()):.1f} degC") + print(f" Heater Housing: {float(self.temperature_heaterhousing.get()):7.2f} °C") print(f" Heater Housing Alarm: {float(self.temperature_heaterhousing_alarm.get()):.0f}") - print(f" OMEGA ALIVE: {float(self.temperature_heaterhousing_alarm.get()):.0f}") + print("") + print("Humidity Sensors:") + print(f" Sensor 1 Humidity: {float(self.humidity_sensor1.get()):7.2f} %RH") + print(f" Sensor 1 Temperature: {float(self.humidity_sensor1_temperature.get()):7.2f} °C") + print(f" Sensor 1 Error: {float(self.humidity_sensor1_err.get()):.0f}") + print(f" Sensor 2 Humidity: {float(self.humidity_sensor2.get()):7.2f} %RH") + print(f" Sensor 2 Temperature: {float(self.humidity_sensor2_temperature.get()):7.2f} °C") + print(f" Sensor 2 Error: {float(self.humidity_sensor2_err.get()):.0f}") + print(f" Humidity Setpoint: {float(self.humidityset.get()):7.2f} %RH") + print("") + print("Flow Control:") + print(f" Flow: {float(self.flow.get()):7.2f} sccm") + print(f" Flow Setpoint (RB): {float(self.flowset.get()):7.2f} sccm") + print("") + print("Suction:") + print(f" Suction: {float(self.suction.get()):7.2f}") + print("") + print("Valves:") + print(f" Dry Valve: {float(self.valvedry.get()):.0f}") + print(f" Wet Valve: {float(self.valvewet.get()):.0f}") + print("") + print("Controller Heartbeats:") + print(f" OMEGA Controller Alive: {self.omega_controller_running()}") + print(f" GALIL Controller Alive: {self.galil_controller_running()}") + print("==============================================") - def help(self): - print("Help for OMNY temperatures:") + print("Help for flOMNI temperature and humidity control system:") + print("Available methods:") + print(" show_all() - display all current values") \ No newline at end of file -- 2.49.1