diff --git a/src/i19serial_ui/gui/serial_gui_eh2.py b/src/i19serial_ui/gui/serial_gui_eh2.py index 2bcb777..8ee21ce 100644 --- a/src/i19serial_ui/gui/serial_gui_eh2.py +++ b/src/i19serial_ui/gui/serial_gui_eh2.py @@ -173,14 +173,11 @@ 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.run_btn = self._create_button("Run Plan", self.run_serial) 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.run_btn) btn_layout.addWidget(self.abort_btn) self.run_btns_group.setLayout(btn_layout) @@ -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): + 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()) rotation_end = rotation_start + num_images + rotation_increment - + detector_z = float(self.inputs.det_dist.text()) + 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("run_serial_from_panda", params) + self.appendOutput("Start serial collection with the panda") self.appendOutput(f"With parameters: {params}") diff --git a/tests/gui/test_eh2_ui.py b/tests/gui/test_eh2_ui.py index 4e7574a..fc4049a 100644 --- a/tests/gui/test_eh2_ui.py +++ b/tests/gui/test_eh2_ui.py @@ -66,36 +66,25 @@ 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 = 117.53 + 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.run_btn.click() + mock_eh2_gui.client.run_plan.assert_called_once_with( + "run_serial_from_panda", mock_params + )