From cd7602e30675edc31772e0d0c2c014ce19149797 Mon Sep 17 00:00:00 2001 From: Shekar V Date: Thu, 6 Jun 2024 11:56:53 -0400 Subject: [PATCH 1/4] Changing 4 beamsize options to 2 V0H0 -> S V1H1 -> L V0H1 and V1H0 removed --- daq_macros.py | 6 +----- gui/control_main.py | 9 +++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/daq_macros.py b/daq_macros.py index f231a7b9..5c50face 100644 --- a/daq_macros.py +++ b/daq_macros.py @@ -4079,12 +4079,8 @@ def set_beamsize(sizeV, sizeH): logger.error("Error: Horizontal size argument has to be \'H0\' or \'H1\'") if (sizeV == 'V0' and sizeH == 'H0'): daq_lib.set_field("size_mode",0) - elif (sizeV == 'V0' and sizeH == 'H1'): - daq_lib.set_field("size_mode",1) - elif (sizeV == 'V1' and sizeH == 'H0'): - daq_lib.set_field("size_mode",2) elif (sizeV == 'V1' and sizeH == 'H1'): - daq_lib.set_field("size_mode",3) + daq_lib.set_field("size_mode",1) else: pass diff --git a/gui/control_main.py b/gui/control_main.py index 85f20961..9aea4ba9 100644 --- a/gui/control_main.py +++ b/gui/control_main.py @@ -544,7 +544,7 @@ def createSampleTab(self): setTransButton = QtWidgets.QPushButton("Set Trans") setTransButton.clicked.connect(self.setTransCB) beamsizeLabel = QtWidgets.QLabel("BeamSize:") - beamSizeOptionList = ["V0H0", "V0H1", "V1H0", "V1H1"] + beamSizeOptionList = ["S", "L"] self.beamsizeComboBox = QtWidgets.QComboBox(self) self.beamsizeComboBox.addItems(beamSizeOptionList) self.beamsizeComboBox.setCurrentIndex(int(self.beamSize_pv.get())) @@ -2518,7 +2518,12 @@ def protoRadioToggledCB(self, text): pass def beamsizeComboActivatedCB(self, text): - self.send_to_server("set_beamsize", [text[0:2], text[2:4]]) + beam_mapping = { + "S": ["V0", "H0"], + "L": ["V1", "H1"] + } + self.send_to_server("set_beamsize", beam_mapping[text]) + def protoComboActivatedCB(self, text): self.showProtParams() From 5b1a3a4141f92441d8634056964aabafa14d18a7 Mon Sep 17 00:00:00 2001 From: Shekar V Date: Thu, 6 Jun 2024 13:47:53 -0400 Subject: [PATCH 2/4] Added beam size options to config params --- daq_macros.py | 11 ++++------- gui/control_main.py | 12 ++++-------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/daq_macros.py b/daq_macros.py index 5c50face..a0018e7a 100644 --- a/daq_macros.py +++ b/daq_macros.py @@ -39,7 +39,7 @@ import bluesky.plans as bp from bluesky.preprocessors import finalize_wrapper, finalize_decorator from fmx_annealer import govStatusGet, govStateSet, fmxAnnealer, amxAnnealer # for using annealer specific to FMX and AMX -from config_params import ON_MOUNT_OPTION, OnMountAvailOptions +from config_params import ON_MOUNT_OPTION, OnMountAvailOptions, BEAMSIZE_OPTIONS from mxbluesky.plans import detect_loop, topview_optimized if daq_utils.beamline == 'fmx': @@ -4077,12 +4077,9 @@ def set_beamsize(sizeV, sizeH): setPvDesc("CRL_H1B_IN",1) else: logger.error("Error: Horizontal size argument has to be \'H0\' or \'H1\'") - if (sizeV == 'V0' and sizeH == 'H0'): - daq_lib.set_field("size_mode",0) - elif (sizeV == 'V1' and sizeH == 'H1'): - daq_lib.set_field("size_mode",1) - else: - pass + for index, key in list(BEAMSIZE_OPTIONS.keys()): + if BEAMSIZE_OPTIONS[key] == [sizeV, sizeH]: + daq_lib.set_field("size_mode", index) diff --git a/gui/control_main.py b/gui/control_main.py index 9aea4ba9..56f6a4f9 100644 --- a/gui/control_main.py +++ b/gui/control_main.py @@ -25,8 +25,10 @@ import db_lib import lsdcOlog from config_params import ( + BEAMSIZE_OPTIONS, CRYOSTREAM_ONLINE, HUTCH_TIMER_DELAY, + MINIMUM_RASTER_SIZE, RASTER_GUI_XREC_FILL_DELAY, SAMPLE_TIMER_DELAY, SERVER_CHECK_DELAY, @@ -37,7 +39,6 @@ VALID_TRANSMISSION, RasterStatus, cryostreamTempPV, - MINIMUM_RASTER_SIZE ) from daq_utils import getBlConfig, setBlConfig from element_info import element_info @@ -544,9 +545,8 @@ def createSampleTab(self): setTransButton = QtWidgets.QPushButton("Set Trans") setTransButton.clicked.connect(self.setTransCB) beamsizeLabel = QtWidgets.QLabel("BeamSize:") - beamSizeOptionList = ["S", "L"] self.beamsizeComboBox = QtWidgets.QComboBox(self) - self.beamsizeComboBox.addItems(beamSizeOptionList) + self.beamsizeComboBox.addItems(BEAMSIZE_OPTIONS.keys()) self.beamsizeComboBox.setCurrentIndex(int(self.beamSize_pv.get())) self.beamsizeComboBox.activated[str].connect(self.beamsizeComboActivatedCB) if daq_utils.beamline == "amx" or self.energy_pv.get() < 9000: @@ -2518,11 +2518,7 @@ def protoRadioToggledCB(self, text): pass def beamsizeComboActivatedCB(self, text): - beam_mapping = { - "S": ["V0", "H0"], - "L": ["V1", "H1"] - } - self.send_to_server("set_beamsize", beam_mapping[text]) + self.send_to_server("set_beamsize", BEAMSIZE_OPTIONS[text]) def protoComboActivatedCB(self, text): From 58070a6aea41e87b11e08a308711af1c22703c4c Mon Sep 17 00:00:00 2001 From: Shekar V Date: Thu, 6 Jun 2024 14:02:10 -0400 Subject: [PATCH 3/4] Added config_params --- config_params.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config_params.py b/config_params.py index b452a480..8b2a9181 100644 --- a/config_params.py +++ b/config_params.py @@ -130,4 +130,9 @@ class OnMountAvailOptions(Enum): EMBL_SERVER_PV_BASE = { "amx": "XF:17IDB-ES:AMX{EMBL}", "fmx": "XF:17IDC-ES:FMX{EMBL}" +} + +BEAMSIZE_OPTIONS = { + "S": ["V0", "H0"], + "L": ["V1", "H1"] } \ No newline at end of file From f113e073989ce1d50b8ab39beb5a74cc58c18c2e Mon Sep 17 00:00:00 2001 From: Shekar V Date: Thu, 6 Jun 2024 14:07:58 -0400 Subject: [PATCH 4/4] Fixed list -> enumerate --- daq_macros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daq_macros.py b/daq_macros.py index a0018e7a..efe57bee 100644 --- a/daq_macros.py +++ b/daq_macros.py @@ -4077,7 +4077,7 @@ def set_beamsize(sizeV, sizeH): setPvDesc("CRL_H1B_IN",1) else: logger.error("Error: Horizontal size argument has to be \'H0\' or \'H1\'") - for index, key in list(BEAMSIZE_OPTIONS.keys()): + for index, key in enumerate(BEAMSIZE_OPTIONS.keys()): if BEAMSIZE_OPTIONS[key] == [sizeV, sizeH]: daq_lib.set_field("size_mode", index)