From d9665d91bf56239a1ad6c9ba51b703f573925d00 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Mon, 9 Mar 2026 16:47:28 +0000 Subject: [PATCH 01/19] Added dropdown, need tests --- src/i19serial_ui/gui/serial_gui_eh2.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index ae8e52a..25151a4 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -126,9 +126,22 @@ def _setup_title(self): self.i19_label.setFont(QtGui.QFont(FONT, 13)) self.i19_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + def _create_dropdown(self): + # Add labels, do tests. + self.aperturedropdown = QtWidgets.QComboBox() + self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) + # self.aperturedropdown.move(10, 10) + + def read_aperture_dropdown(self): + return self.aperturedropdown.currentText() + def _create_top_group(self): # move arrows, phi step, focuse, backlight etc + self._create_dropdown() self.top_group = QtWidgets.QGroupBox() + top_layout = QtWidgets.QHBoxLayout() + top_layout.addWidget(self.aperturedropdown) + self.top_group.setLayout(top_layout) def _create_coordinate_system_group(self): self.cs_group = QtWidgets.QGroupBox("Coordinate System") From 7396826c0aa9aee00c041ecb8946611f90b0325a Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 10 Mar 2026 12:23:22 +0000 Subject: [PATCH 02/19] Added unit testing of GUI and labels to drop-down box --- src/i19serial_ui/gui/serial_gui_eh2.py | 5 ++++- tests/gui/test_eh2_ui.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 25151a4..e8225b1 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -130,7 +130,6 @@ def _create_dropdown(self): # Add labels, do tests. self.aperturedropdown = QtWidgets.QComboBox() self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) - # self.aperturedropdown.move(10, 10) def read_aperture_dropdown(self): return self.aperturedropdown.currentText() @@ -140,6 +139,10 @@ def _create_top_group(self): self._create_dropdown() self.top_group = QtWidgets.QGroupBox() top_layout = QtWidgets.QHBoxLayout() + self.ddb_label = QtWidgets.QLabel("Select aperture size:") + self.ddb_label.setFont(QtGui.QFont(FONT, 10)) + self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + top_layout.addWidget(self.ddb_label) top_layout.addWidget(self.aperturedropdown) self.top_group.setLayout(top_layout) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 1c288cb..93ee4cf 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -29,6 +29,9 @@ def test_all_widgets_initialised(mock_eh2_gui): assert mock_eh2_gui.inputs and isinstance(mock_eh2_gui.inputs, InputPanel) assert mock_eh2_gui.wells and isinstance(mock_eh2_gui.wells, WellsSelectionPanel) assert mock_eh2_gui.grid and isinstance(mock_eh2_gui.grid, GridOptions) + assert mock_eh2_gui.aperturedropdown and isinstance( + mock_eh2_gui.aperturedropdown, QtWidgets.QComboBox + ) def test_general_layout(mock_eh2_gui): @@ -36,6 +39,17 @@ def test_general_layout(mock_eh2_gui): assert isinstance(mock_eh2_gui.general_layout, QtWidgets.QGridLayout) title = mock_eh2_gui.general_layout.children()[0] assert isinstance(title, QtWidgets.QHBoxLayout) + assert isinstance(mock_eh2_gui.top_group, QtWidgets.QGroupBox) + + +def test_dropdown_update(mock_eh2_gui): + options = ["20um", "40um", "100um", "3000um"] + for x in range(0, 3): + mock_eh2_gui.aperturedropdown.setCurrentIndex(x) + assert mock_eh2_gui.aperturedropdown.currentText() == options[x] + + +# def test_top_layout(mock_eh2_gui): def test_select_visit(mock_eh2_gui): From 9269ce219d06c2a2285be3bac90096156e82dcdf Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 10 Mar 2026 12:27:08 +0000 Subject: [PATCH 03/19] Added unit testing of GUI and labels to drop-down box, altered one unit test --- tests/gui/test_eh2_ui.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 93ee4cf..37895f4 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -46,10 +46,7 @@ def test_dropdown_update(mock_eh2_gui): options = ["20um", "40um", "100um", "3000um"] for x in range(0, 3): mock_eh2_gui.aperturedropdown.setCurrentIndex(x) - assert mock_eh2_gui.aperturedropdown.currentText() == options[x] - - -# def test_top_layout(mock_eh2_gui): + assert mock_eh2_gui.read_aperture_dropdown() == options[x] def test_select_visit(mock_eh2_gui): From 5128d66a0c46700c4cdc87cc29de9c72d8d044c3 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Mon, 9 Mar 2026 16:47:28 +0000 Subject: [PATCH 04/19] Added dropdown, need tests --- src/i19serial_ui/gui/serial_gui_eh2.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index ae8e52a..25151a4 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -126,9 +126,22 @@ def _setup_title(self): self.i19_label.setFont(QtGui.QFont(FONT, 13)) self.i19_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + def _create_dropdown(self): + # Add labels, do tests. + self.aperturedropdown = QtWidgets.QComboBox() + self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) + # self.aperturedropdown.move(10, 10) + + def read_aperture_dropdown(self): + return self.aperturedropdown.currentText() + def _create_top_group(self): # move arrows, phi step, focuse, backlight etc + self._create_dropdown() self.top_group = QtWidgets.QGroupBox() + top_layout = QtWidgets.QHBoxLayout() + top_layout.addWidget(self.aperturedropdown) + self.top_group.setLayout(top_layout) def _create_coordinate_system_group(self): self.cs_group = QtWidgets.QGroupBox("Coordinate System") From b4ccf2c9d8d22e3b89ff6e250de21e7da2720c4f Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 10 Mar 2026 12:23:22 +0000 Subject: [PATCH 05/19] Added unit testing of GUI and labels to drop-down box --- src/i19serial_ui/gui/serial_gui_eh2.py | 5 ++++- tests/gui/test_eh2_ui.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 25151a4..e8225b1 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -130,7 +130,6 @@ def _create_dropdown(self): # Add labels, do tests. self.aperturedropdown = QtWidgets.QComboBox() self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) - # self.aperturedropdown.move(10, 10) def read_aperture_dropdown(self): return self.aperturedropdown.currentText() @@ -140,6 +139,10 @@ def _create_top_group(self): self._create_dropdown() self.top_group = QtWidgets.QGroupBox() top_layout = QtWidgets.QHBoxLayout() + self.ddb_label = QtWidgets.QLabel("Select aperture size:") + self.ddb_label.setFont(QtGui.QFont(FONT, 10)) + self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + top_layout.addWidget(self.ddb_label) top_layout.addWidget(self.aperturedropdown) self.top_group.setLayout(top_layout) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 1c288cb..93ee4cf 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -29,6 +29,9 @@ def test_all_widgets_initialised(mock_eh2_gui): assert mock_eh2_gui.inputs and isinstance(mock_eh2_gui.inputs, InputPanel) assert mock_eh2_gui.wells and isinstance(mock_eh2_gui.wells, WellsSelectionPanel) assert mock_eh2_gui.grid and isinstance(mock_eh2_gui.grid, GridOptions) + assert mock_eh2_gui.aperturedropdown and isinstance( + mock_eh2_gui.aperturedropdown, QtWidgets.QComboBox + ) def test_general_layout(mock_eh2_gui): @@ -36,6 +39,17 @@ def test_general_layout(mock_eh2_gui): assert isinstance(mock_eh2_gui.general_layout, QtWidgets.QGridLayout) title = mock_eh2_gui.general_layout.children()[0] assert isinstance(title, QtWidgets.QHBoxLayout) + assert isinstance(mock_eh2_gui.top_group, QtWidgets.QGroupBox) + + +def test_dropdown_update(mock_eh2_gui): + options = ["20um", "40um", "100um", "3000um"] + for x in range(0, 3): + mock_eh2_gui.aperturedropdown.setCurrentIndex(x) + assert mock_eh2_gui.aperturedropdown.currentText() == options[x] + + +# def test_top_layout(mock_eh2_gui): def test_select_visit(mock_eh2_gui): From ec8d5c607140bbc2c866d5c2a9af4bb066ae2a99 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 10 Mar 2026 12:27:08 +0000 Subject: [PATCH 06/19] Added unit testing of GUI and labels to drop-down box, altered one unit test --- tests/gui/test_eh2_ui.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 93ee4cf..37895f4 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -46,10 +46,7 @@ def test_dropdown_update(mock_eh2_gui): options = ["20um", "40um", "100um", "3000um"] for x in range(0, 3): mock_eh2_gui.aperturedropdown.setCurrentIndex(x) - assert mock_eh2_gui.aperturedropdown.currentText() == options[x] - - -# def test_top_layout(mock_eh2_gui): + assert mock_eh2_gui.read_aperture_dropdown() == options[x] def test_select_visit(mock_eh2_gui): From 7fdc4f93d8fdb18c0d8cf8bd9434b4f820f1a631 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 10 Mar 2026 16:11:55 +0000 Subject: [PATCH 07/19] Edited post pull. --- src/i19serial_ui/gui/serial_gui_eh2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index e8225b1..faa5ced 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -127,7 +127,6 @@ def _setup_title(self): self.i19_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) def _create_dropdown(self): - # Add labels, do tests. self.aperturedropdown = QtWidgets.QComboBox() self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) From f8333cb4b52834d8410babace5f83b45bf3fb896 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Wed, 11 Mar 2026 15:26:18 +0000 Subject: [PATCH 08/19] changed layout of top box, saved choice as variable, moved aperture size into general_utils file --- src/i19serial_ui/gui/serial_gui_eh2.py | 11 ++++++++--- src/i19serial_ui/parameters/general_utils.py | 8 ++++++++ tests/gui/test_eh2_ui.py | 11 ++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 src/i19serial_ui/parameters/general_utils.py diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index faa5ced..2bcb777 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -23,6 +23,7 @@ log_to_gui, tidy_up_logging, ) +from i19serial_ui.parameters.general_utils import ApertureOptions WINDOW_SIZE = (600, 1200) LOG_HANDLERS = [] @@ -128,7 +129,8 @@ def _setup_title(self): def _create_dropdown(self): self.aperturedropdown = QtWidgets.QComboBox() - self.aperturedropdown.addItems(["20um", "40um", "100um", "3000um"]) + self.aperturedropdown.addItems(list(ApertureOptions)) + self.selected_aperture = self.read_aperture_dropdown() def read_aperture_dropdown(self): return self.aperturedropdown.currentText() @@ -137,13 +139,15 @@ def _create_top_group(self): # move arrows, phi step, focuse, backlight etc self._create_dropdown() self.top_group = QtWidgets.QGroupBox() - top_layout = QtWidgets.QHBoxLayout() + top_layout = QtWidgets.QGridLayout() self.ddb_label = QtWidgets.QLabel("Select aperture size:") self.ddb_label.setFont(QtGui.QFont(FONT, 10)) - self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) top_layout.addWidget(self.ddb_label) top_layout.addWidget(self.aperturedropdown) self.top_group.setLayout(top_layout) + self.aperturedropdown.setFixedWidth(150) + top_layout.setColumnStretch(2, 1) def _create_coordinate_system_group(self): self.cs_group = QtWidgets.QGroupBox("Coordinate System") @@ -248,6 +252,7 @@ def run_panda(self): num_images = float(self.inputs.num_images.text()) rotation_increment = float(self.inputs.image_width.text()) rotation_end = rotation_start + num_images + rotation_increment + params = { "phi_start": rotation_start, "phi_end": rotation_end, diff --git a/src/i19serial_ui/parameters/general_utils.py b/src/i19serial_ui/parameters/general_utils.py new file mode 100644 index 0000000..ea4b3ad --- /dev/null +++ b/src/i19serial_ui/parameters/general_utils.py @@ -0,0 +1,8 @@ +from enum import StrEnum + + +class ApertureOptions(StrEnum): + um_20 = "20um" + um_40 = "40um" + um_100 = "100um" + um_3000 = "3000um" diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 37895f4..eb4f17e 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -42,11 +42,12 @@ def test_general_layout(mock_eh2_gui): assert isinstance(mock_eh2_gui.top_group, QtWidgets.QGroupBox) -def test_dropdown_update(mock_eh2_gui): - options = ["20um", "40um", "100um", "3000um"] - for x in range(0, 3): - mock_eh2_gui.aperturedropdown.setCurrentIndex(x) - assert mock_eh2_gui.read_aperture_dropdown() == options[x] +@pytest.mark.parametrize( + "options,index", [("20um", 0), ("40um", 1), ("100um", 2), ("3000um", 3)] +) +def test_dropdown_update(mock_eh2_gui, options, index): + mock_eh2_gui.aperturedropdown.setCurrentIndex(index) + assert mock_eh2_gui.read_aperture_dropdown() == options def test_select_visit(mock_eh2_gui): From ab31f5db77cdaf12d85fc7832c82aaf48526c9b4 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 12 Mar 2026 14:51:09 +0000 Subject: [PATCH 09/19] Altering remaining code according to comments --- src/i19serial_ui/parameters/general_utils.py | 8 ++++---- tests/gui/test_eh2_ui.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/i19serial_ui/parameters/general_utils.py b/src/i19serial_ui/parameters/general_utils.py index ea4b3ad..ea96d92 100644 --- a/src/i19serial_ui/parameters/general_utils.py +++ b/src/i19serial_ui/parameters/general_utils.py @@ -2,7 +2,7 @@ class ApertureOptions(StrEnum): - um_20 = "20um" - um_40 = "40um" - um_100 = "100um" - um_3000 = "3000um" + UM_20 = "20um" + UM_40 = "40um" + UM_100 = "100um" + UM_3000 = "3000um" diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index eb4f17e..e6ce1d1 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -43,7 +43,7 @@ def test_general_layout(mock_eh2_gui): @pytest.mark.parametrize( - "options,index", [("20um", 0), ("40um", 1), ("100um", 2), ("3000um", 3)] + "aperture,index", [("20um", 0), ("40um", 1), ("100um", 2), ("3000um", 3)] ) def test_dropdown_update(mock_eh2_gui, options, index): mock_eh2_gui.aperturedropdown.setCurrentIndex(index) From 416abdaf255d9bfdddf7cbe0abfe05266ecbb81e Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 12 Mar 2026 14:55:49 +0000 Subject: [PATCH 10/19] Altering remaining code according to comments - remembering to alter variable names properly --- tests/gui/test_eh2_ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index e6ce1d1..4e7574a 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -45,9 +45,9 @@ def test_general_layout(mock_eh2_gui): @pytest.mark.parametrize( "aperture,index", [("20um", 0), ("40um", 1), ("100um", 2), ("3000um", 3)] ) -def test_dropdown_update(mock_eh2_gui, options, index): +def test_dropdown_update(mock_eh2_gui, aperture, index): mock_eh2_gui.aperturedropdown.setCurrentIndex(index) - assert mock_eh2_gui.read_aperture_dropdown() == options + assert mock_eh2_gui.read_aperture_dropdown() == aperture def test_select_visit(mock_eh2_gui): From e3063acb31c7451e560e381f90f0241817fc4582 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Mon, 16 Mar 2026 15:15:54 +0000 Subject: [PATCH 11/19] changing gui and test to remove zebra, run only main_entry_plan --- src/i19serial_ui/gui/serial_gui_eh2.py | 33 +++++++------------------- tests/gui/test_eh2_ui.py | 27 ++++++--------------- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 2bcb777..7594ae3 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -173,13 +173,10 @@ def _create_collection_buttons_group(self): self.run_btns_group = QtWidgets.QGroupBox() btn_layout = QtWidgets.QHBoxLayout() - self.test_btn1 = self._create_button("Run zebra", self.run_zebra) - - self.test_btn2 = self._create_button("Run panda", self.run_panda) + self.test_btn2 = self._create_button("Run Plan", self.run_panda) self.abort_btn = self._create_button("Abort", self.abort) - btn_layout.addWidget(self.test_btn1) btn_layout.addWidget(self.test_btn2) btn_layout.addWidget(self.abort_btn) @@ -230,37 +227,25 @@ def abort(self): self.client.abort_task() self.appendOutput("Abort") - def run_zebra(self): - rotation_start = float(self.inputs.rotation_start.text()) - num_images = float(self.inputs.num_images.text()) - rotation_increment = float(self.inputs.image_width.text()) - rotation_end = rotation_start + num_images + rotation_increment - params = { - "phi_start": rotation_start, - "phi_end": rotation_end, - "phi_steps": num_images, - "exposure_time": float(self.inputs.time_image.text()), - "gate_width": rotation_end - rotation_start + 0.1, - "pulse_width": rotation_increment, - } - self.client.run_plan("run_zebra_test", params) - self.appendOutput("Run zebra plan") - self.appendOutput(f"With parameters: {params}") - def run_panda(self): rotation_start = float(self.inputs.rotation_start.text()) num_images = float(self.inputs.num_images.text()) rotation_increment = float(self.inputs.image_width.text()) rotation_end = rotation_start + num_images + rotation_increment - + detector_z = 100 + detector_two_theta = float(self.inputs.two_theta.text()) + eh2_aperture = self.read_aperture_dropdown() params = { + "detector_z": detector_z, + "detector_two_theta": detector_two_theta, "phi_start": rotation_start, "phi_end": rotation_end, "phi_steps": num_images, "exposure_time": float(self.inputs.time_image.text()), + "eh2_aperture": eh2_aperture, } - self.client.run_plan("run_panda_test", params) - self.appendOutput("Run panda plan") + self.client.run_plan("main_entry_plan", params) + self.appendOutput("Run main_entry_plan") self.appendOutput(f"With parameters: {params}") diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 4e7574a..d8c391c 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -66,36 +66,23 @@ def test_abort_button(mock_eh2_gui): mock_eh2_gui.client.abort_task.assert_called_once() -def test_run_zebra(mock_eh2_gui): - mock_rotation_start = 0.0 - mock_num_images = 50.0 - mock_rotation_increment = 0.2 - mock_rotation_end = mock_rotation_start + mock_num_images + mock_rotation_increment - mock_time_image = 0.2 - - mock_params = { - "phi_start": mock_rotation_start, - "phi_end": mock_rotation_end, - "phi_steps": mock_num_images, - "exposure_time": mock_time_image, - "gate_width": mock_rotation_end - mock_rotation_start + 0.1, - "pulse_width": mock_rotation_increment, - } - mock_eh2_gui.test_btn1.click() - mock_eh2_gui.client.run_plan.assert_called_once_with("run_zebra_test", mock_params) - - def test_run_panda(mock_eh2_gui): + mock_detector_z = 100 + mock_eh2_aperture = "20um" # ApertureOptions.UM_20 + mock_detector_two_theta = 0.0 mock_rotation_start = 0.0 mock_num_images = 50.0 mock_rotation_increment = 0.2 mock_rotation_end = mock_rotation_start + mock_num_images + mock_rotation_increment mock_time_image = 0.2 mock_params = { + "detector_z": mock_detector_z, + "detector_two_theta": mock_detector_two_theta, "phi_start": mock_rotation_start, "phi_end": mock_rotation_end, "phi_steps": mock_num_images, "exposure_time": mock_time_image, + "eh2_aperture": mock_eh2_aperture, } mock_eh2_gui.test_btn2.click() - mock_eh2_gui.client.run_plan.assert_called_once_with("run_panda_test", mock_params) + mock_eh2_gui.client.run_plan.assert_called_once_with("main_entry_plan", mock_params) From 7eba0bc8cd0ddd8ed3b2440b68b6a98edd4b51f6 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Mon, 9 Mar 2026 16:47:28 +0000 Subject: [PATCH 12/19] Added dropdown, need tests --- src/i19serial_ui/gui/serial_gui_eh2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 7594ae3..d11a8ad 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -138,6 +138,7 @@ def read_aperture_dropdown(self): def _create_top_group(self): # move arrows, phi step, focuse, backlight etc self._create_dropdown() + self._create_dropdown() self.top_group = QtWidgets.QGroupBox() top_layout = QtWidgets.QGridLayout() self.ddb_label = QtWidgets.QLabel("Select aperture size:") From 5d51acf07665af580be7e6796ca9d0d0eea0889d Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Mon, 16 Mar 2026 17:14:32 +0000 Subject: [PATCH 13/19] changed layout of top box, saved choice as variable, moved aperture size into general_utils file --- src/i19serial_ui/gui/serial_gui_eh2.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index d11a8ad..30aa004 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -145,10 +145,17 @@ def _create_top_group(self): self.ddb_label.setFont(QtGui.QFont(FONT, 10)) self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) top_layout.addWidget(self.ddb_label) + top_layout = QtWidgets.QGridLayout() + self.ddb_label = QtWidgets.QLabel("Select aperture size:") + self.ddb_label.setFont(QtGui.QFont(FONT, 10)) + self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft) + top_layout.addWidget(self.ddb_label) top_layout.addWidget(self.aperturedropdown) self.top_group.setLayout(top_layout) self.aperturedropdown.setFixedWidth(150) top_layout.setColumnStretch(2, 1) + self.aperturedropdown.setFixedWidth(150) + top_layout.setColumnStretch(2, 1) def _create_coordinate_system_group(self): self.cs_group = QtWidgets.QGroupBox("Coordinate System") From 0eaa1d503f3a168d8d1deab35c438c258f627358 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Tue, 17 Mar 2026 14:43:54 +0000 Subject: [PATCH 14/19] Collected detector_z from ui --- FETCH_HEAD | 0 src/i19serial_ui/gui/serial_gui_eh2.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 FETCH_HEAD diff --git a/FETCH_HEAD b/FETCH_HEAD new file mode 100644 index 0000000..e69de29 diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 7594ae3..81ff2f4 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -232,7 +232,7 @@ def run_panda(self): num_images = float(self.inputs.num_images.text()) rotation_increment = float(self.inputs.image_width.text()) rotation_end = rotation_start + num_images + rotation_increment - detector_z = 100 + detector_z = float(self.inputs.det_dist.text()) detector_two_theta = float(self.inputs.two_theta.text()) eh2_aperture = self.read_aperture_dropdown() params = { From addf8e8ed1a1669e8efc0317ed7c9c79b8c0e716 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Wed, 18 Mar 2026 09:11:59 +0000 Subject: [PATCH 15/19] rewrote test --- tests/gui/test_eh2_ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index d8c391c..9998bd9 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -67,7 +67,7 @@ def test_abort_button(mock_eh2_gui): def test_run_panda(mock_eh2_gui): - mock_detector_z = 100 + mock_detector_z = 117.53 mock_eh2_aperture = "20um" # ApertureOptions.UM_20 mock_detector_two_theta = 0.0 mock_rotation_start = 0.0 From b8b69f3e2efbcc4778e7dfd52c1e1e334674473d Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 19 Mar 2026 09:00:36 +0000 Subject: [PATCH 16/19] updated name of plan --- src/i19serial_ui/gui/serial_gui_eh2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 81ff2f4..f2fe666 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -244,8 +244,8 @@ def run_panda(self): "exposure_time": float(self.inputs.time_image.text()), "eh2_aperture": eh2_aperture, } - self.client.run_plan("main_entry_plan", params) - self.appendOutput("Run main_entry_plan") + self.client.run_plan("run_serial_from_panda", params) + self.appendOutput("Run serial from panda") self.appendOutput(f"With parameters: {params}") From 7240b722dc1ed10e25839574dccbdcccde655f45 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 19 Mar 2026 09:10:44 +0000 Subject: [PATCH 17/19] updated name of plan in testing --- tests/gui/test_eh2_ui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 9998bd9..981ed00 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -85,4 +85,6 @@ def test_run_panda(mock_eh2_gui): "eh2_aperture": mock_eh2_aperture, } mock_eh2_gui.test_btn2.click() - mock_eh2_gui.client.run_plan.assert_called_once_with("main_entry_plan", mock_params) + mock_eh2_gui.client.run_plan.assert_called_once_with( + "run_serial_from_panda", mock_params + ) From d95c157bea88fcbc370e97e62b6b86037793a8bb Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 19 Mar 2026 11:41:48 +0000 Subject: [PATCH 18/19] renames button based on comments --- FETCH_HEAD | 0 src/i19serial_ui/gui/serial_gui_eh2.py | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 FETCH_HEAD diff --git a/FETCH_HEAD b/FETCH_HEAD deleted file mode 100644 index e69de29..0000000 diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index f2fe666..3a06153 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -173,7 +173,7 @@ def _create_collection_buttons_group(self): self.run_btns_group = QtWidgets.QGroupBox() btn_layout = QtWidgets.QHBoxLayout() - self.test_btn2 = self._create_button("Run Plan", self.run_panda) + self.test_btn2 = self._create_button("Run Plan", self.run_btn) self.abort_btn = self._create_button("Abort", self.abort) @@ -227,7 +227,7 @@ def abort(self): self.client.abort_task() self.appendOutput("Abort") - def run_panda(self): + def run_btn(self): rotation_start = float(self.inputs.rotation_start.text()) num_images = float(self.inputs.num_images.text()) rotation_increment = float(self.inputs.image_width.text()) @@ -245,7 +245,7 @@ def run_panda(self): "eh2_aperture": eh2_aperture, } self.client.run_plan("run_serial_from_panda", params) - self.appendOutput("Run serial from panda") + self.appendOutput("Start serial collection with the panda") self.appendOutput(f"With parameters: {params}") From d54b3e950cbe726654de4b9b3e6269ca9e1ffef1 Mon Sep 17 00:00:00 2001 From: Matthew Carre Date: Thu, 19 Mar 2026 13:20:40 +0000 Subject: [PATCH 19/19] altered remaining comments --- src/i19serial_ui/gui/serial_gui_eh2.py | 6 +++--- tests/gui/test_eh2_ui.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 3a06153..8ee21ce 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -173,11 +173,11 @@ def _create_collection_buttons_group(self): self.run_btns_group = QtWidgets.QGroupBox() btn_layout = QtWidgets.QHBoxLayout() - self.test_btn2 = self._create_button("Run Plan", self.run_btn) + self.run_btn = self._create_button("Run Plan", self.run_serial) self.abort_btn = self._create_button("Abort", self.abort) - btn_layout.addWidget(self.test_btn2) + btn_layout.addWidget(self.run_btn) btn_layout.addWidget(self.abort_btn) self.run_btns_group.setLayout(btn_layout) @@ -227,7 +227,7 @@ def abort(self): self.client.abort_task() self.appendOutput("Abort") - def run_btn(self): + def run_serial(self): rotation_start = float(self.inputs.rotation_start.text()) num_images = float(self.inputs.num_images.text()) rotation_increment = float(self.inputs.image_width.text()) diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 981ed00..fc4049a 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -84,7 +84,7 @@ def test_run_panda(mock_eh2_gui): "exposure_time": mock_time_image, "eh2_aperture": mock_eh2_aperture, } - mock_eh2_gui.test_btn2.click() + mock_eh2_gui.run_btn.click() mock_eh2_gui.client.run_plan.assert_called_once_with( "run_serial_from_panda", mock_params )