fix(lamni): interferometer position readout, scan-center drift and central stop moves
CI for csaxs_bec / test (push) Failing after 3m14s

- show_interferometer_positions() now calls the controller's positions
  method (was calling show_feedback_status) and the method is exposed via
  USER_ACCESS; loop status is taken from J2 like feedback_status() instead
  of misreading the J4 status field (reported True with feedback off).
- lamni_new_scan_center_interferometer: a first-iteration drift above
  150 um is now discarded instead of being skipped in the first move but
  still added in the second iteration.
- loptics_in()/loptics_out() now also move the central stop; lcs_in()
  moves lcsx/lcsy to their configured "in" position and lcs_out() moves
  lcsy to its configured "out" position (was hardcoded 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
x12saandClaude Opus 5.5 committed 2026-10-12 17:49:34 +02:00
1 parent d56a2a6d47
commit 2f238a2cc3
4 files changed
+38 -11

No files matched your search

@@ -778,7 +778,7 @@ class LamNI(
self.device_manager.devices.rtx.controller.show_feedback_status()
def show_interferometer_positions(self):
self.device_manager.devices.rtx.controller.show_feedback_status()
return self.device_manager.devices.rtx.controller.show_interferometer_positions()
def show_signal_strength(self):
self.device_manager.devices.rtx.controller.show_signal_strength_interferometer()
@@ -403,9 +403,10 @@ class LamNIOpticsMixin:
)
def loptics_in(self):
"""Move in the LamNI optics (FZP + OSA)."""
"""Move in the LamNI optics (FZP + OSA + central stop)."""
self.lfzp_in()
self.losa_in()
self.lcs_in()
def _check_eye_out_and_optics_in(self, tol=0.003):
"""True if the setup is in measurement configuration: X-ray eye OUT,
@@ -452,10 +453,11 @@ class LamNIOpticsMixin:
return eye_out and optics_in and osa_in
def loptics_out(self):
"""Move out the LamNI optics."""
"""Move out the LamNI optics (central stop + OSA + FZP)."""
if "rtx" in dev and dev.rtx.enabled:
dev.rtx.controller.feedback_disable()
self.lcs_out()
self.losa_out()
loptx_out = self._get_user_param_safe("loptx", "out")
lopty_out = self._get_user_param_safe("lopty", "out")
@@ -469,10 +471,31 @@ class LamNIOpticsMixin:
print(f"Interferometer feedback re-established ({time.time() - _t0:.1f} s).")
def lcs_in(self):
pass
lcsx_in = self._get_user_param_safe("lcsx", "in")
lcsy_in = self._get_user_param_safe("lcsy", "in")
current_lcsx = dev.lcsx.readback.get()
current_lcsy = dev.lcsy.readback.get()
tol = 0.003
need_move_cs = not np.isclose(current_lcsx, lcsx_in, atol=tol) or not np.isclose(
current_lcsy, lcsy_in, atol=tol
)
if need_move_cs:
umv(dev.lcsx, lcsx_in, dev.lcsy, lcsy_in)
else:
print("Central stop is already at the IN position.")
def lcs_out(self):
umv(dev.lcsy, 3)
# only lcsy has an "out" position; lcsx stays where it is
lcsy_out = self._get_user_param_safe("lcsy", "out")
if not np.isclose(dev.lcsy.readback.get(), lcsy_out, atol=0.003):
umv(dev.lcsy, lcsy_out)
else:
print("Central stop is already at the OUT position.")
def losa_in(self):
losax_in = self._get_user_param_safe("losax", "in")
+2 -1
View File
@@ -53,6 +53,7 @@ class RtLamniController(Controller):
"show_signal_strength_interferometer",
"show_analog_signals",
"show_feedback_status",
"show_interferometer_positions",
]
def __init__(
@@ -293,7 +294,7 @@ class RtLamniController(Controller):
def show_interferometer_positions(self) -> dict:
return_table = (self.socket_put_and_receive("J4")).split(",")
loop_status = bool(int(float(return_table[0])))
loop_status = self.feedback_is_running()
pos_y = float(return_table[1])
pos_x = float(return_table[2])
+8 -5
View File
@@ -87,6 +87,13 @@ class LamNIComponents(ScanComponents):
logger.info(f"Current uncompensated drift of setup is x={x_drift:.3f}, y={y_drift:.3f}")
# a drift this large is not trusted (e.g. interferometer reset or error);
# drop it so the second iteration does not apply it either
if np.abs(y_drift) > 150 or np.abs(x_drift) > 150:
logger.info("Drift exceeds 150 microns, ignoring it.")
x_drift = 0.0
y_drift = 0.0
move_x = (
x_stage + lsamx_center + self.lamni_to_stage_coordinates(x_drift, y_drift)[0] / 1000
)
@@ -100,11 +107,7 @@ class LamNIComponents(ScanComponents):
self._dev.lsamx.read_only = False
self._dev.lsamy.read_only = False
if (
np.abs(y_drift) > 150
or np.abs(x_drift) > 150
or (coarse_move_req_y < 0.003 and coarse_move_req_x < 0.003)
):
if coarse_move_req_y < 0.003 and coarse_move_req_x < 0.003:
logger.info("No drift correction.")
else:
logger.info(