perf(LamNI): skip redundant lsamrot rotate-to-0 right after loptics_out() #275
@@ -129,6 +129,21 @@ class XrayEyeAlign:
|
||||
def get_tomo_angle(self) -> float:
|
||||
return self.device_manager.devices.lsamrot.readback.read()["lsamrot"]["value"]
|
||||
|
||||
def _tomo_rotate_if_needed(self, val: float, tol: float = 0.05):
|
||||
"""Rotate lsamrot to `val` unless it's already there.
|
||||
|
||||
Used right after loptics_out(), which -- when rtx is enabled -- already
|
||||
drives lsamrot to 0 via feedback_enable_with_reset()
|
||||
(RtLamniController.feedback_enable_with_reset() in rt_lamni_ophyd.py).
|
||||
Re-issuing the same move there would be a redundant round trip; this
|
||||
still corrects the small residual drift that can creep in while
|
||||
feedback briefly runs between that internal move and the explicit
|
||||
_disable_rt_feedback() call, and still moves lsamrot when rtx is
|
||||
disabled (loptics_out() then never touches it at all).
|
||||
"""
|
||||
if not np.isclose(self.get_tomo_angle(), val, atol=tol):
|
||||
self.tomo_rotate(val)
|
||||
|
||||
def _disable_rt_feedback(self):
|
||||
self.device_manager.devices.rtx.controller.feedback_disable()
|
||||
|
||||
@@ -836,7 +851,7 @@ class XrayEyeAlign:
|
||||
self.send_message("Please wait - moving sample in...")
|
||||
self.lamni.loptics_out()
|
||||
self._disable_rt_feedback()
|
||||
self.tomo_rotate(0)
|
||||
self._tomo_rotate_if_needed(0)
|
||||
self.update_frame(keep_shutter_open)
|
||||
self.gui.set_crosshair_position(fzp_x / self.pixel_calibration, fzp_y / self.pixel_calibration)
|
||||
self.gui.show_crosshair()
|
||||
@@ -1126,7 +1141,7 @@ class XrayEyeAlign:
|
||||
self.send_message("Please wait - moving sample in...")
|
||||
self.lamni.loptics_out()
|
||||
self._disable_rt_feedback()
|
||||
self.tomo_rotate(0)
|
||||
self._tomo_rotate_if_needed(0)
|
||||
self.update_frame(keep_shutter_open)
|
||||
self.gui.set_crosshair_position(fzp_x / self.pixel_calibration, fzp_y / self.pixel_calibration)
|
||||
self.gui.show_crosshair()
|
||||
|
||||
Reference in New Issue
Block a user