diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py index 0e9d86a8..5abde1d7 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py @@ -32,6 +32,7 @@ from csaxs_bec.bec_ipython_client.plugins.OMNY_shared.tomo_angle_file_mixin impo TomoAngleFileMixin, ) from csaxs_bec.bec_ipython_client.plugins.OMNY_shared.tomo_queue_mixin import TomoQueueMixin +from csaxs_bec.scans.lamni_components import LamNIComponents from .lamni_optics_mixin import LaMNIInitStages, LamNIOpticsMixin from .x_ray_eye_align import XrayEyeAlign as XrayEyeAlignGUI @@ -1410,6 +1411,15 @@ class LamNI( additional_correction = self.compute_additional_correction(angle) additional_correction_2 = self.compute_additional_correction_2(angle) correction_xeye_mu = self.lamni_compute_additional_correction_xeye_mu(angle) + # base shift (center finding / first X-ray eye click), rotated to this + # angle by lamni_fermat_scan via center_x/center_y + base_x, base_y = LamNIComponents.lamni_compute_scan_center( + self.tomo_fovx_offset, self.tomo_fovy_offset, angle + ) + print( + f"Base shift: x={self.tomo_fovx_offset:.6f} mm, y={self.tomo_fovy_offset:.6f} mm" + f" at 0 deg -> x={base_x:.6f} mm, y={base_y:.6f} mm @ angle={angle}" + ) print(f"Constant shift: x={self.manual_shift_x}, y={self.manual_shift_y}") self._current_scan_list = [] diff --git a/tests/tests_bec_ipython_client/test_lamni_golive_fixes.py b/tests/tests_bec_ipython_client/test_lamni_golive_fixes.py index 936a0dca..e0108dc1 100644 --- a/tests/tests_bec_ipython_client/test_lamni_golive_fixes.py +++ b/tests/tests_bec_ipython_client/test_lamni_golive_fixes.py @@ -428,6 +428,21 @@ def test_tomo_scan_projection_reconstructs_once_per_projection_not_per_tile(proj assert projection_env.reconstruct_calls == [1] +def test_tomo_scan_projection_prints_base_shift(projection_env, capsys): + from csaxs_bec.scans.lamni_components import LamNIComponents + + # stored in um (X-ray eye shift_xy); tomo_fovx/y_offset return mm + projection_env.client.set_global_var("tomo_fov_offset", [100.0, 200.0]) + projection_env.tomo_scan_projection(30.0, _internal=True) + + rot_x, rot_y = LamNIComponents.lamni_compute_scan_center(0.1, 0.2, 30.0) + out = capsys.readouterr().out + assert ( + f"Base shift: x=0.100000 mm, y=0.200000 mm at 0 deg -> " + f"x={rot_x:.6f} mm, y={rot_y:.6f} mm @ angle=30.0" + ) in out + + def test_tomo_scan_projection_can_skip_reconstruction(projection_env): projection_env.tomo_scan_projection(30.0, _internal=True, _reconstruct=False)