From 8b7cc2594476b48229dc198a0c8a2abea385b031 Mon Sep 17 00:00:00 2001 From: Francesco De Carlo Date: Thu, 16 Apr 2026 16:54:07 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20spurious=20rotation=20back-and-forth=20wh?= =?UTF-8?q?en=20collecting=20post-scan=20flat=20fields=20(reported=20as=20?= =?UTF-8?q?issue=20#177)=20When=20SampleOutAngleEnable=3DYes=20and=20FlatF?= =?UTF-8?q?ieldMode=3DEnd=20or=20Both,=20end=5Fscan()=20called=20move=5Fsa?= =?UTF-8?q?mple=5Fin()=20which=20restored=20self.rotation=5Fsave=20to=20th?= =?UTF-8?q?e=20end-of-scan=20angle.=20ReturnRotation=20then=20immediately?= =?UTF-8?q?=20moved=20the=20rotation=20to=20rotation=5Fstart,=20producing?= =?UTF-8?q?=20an=20unnecessary=20intermediate=20move=20(e.g.=20SampleOutAn?= =?UTF-8?q?gle=20=E2=86=92=20rotation=5Fstop=20=E2=86=92=20rotation=5Fstar?= =?UTF-8?q?t).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix: clear self.rotation_save before move_sample_in() in end_scan() so only the X/Y stage is moved back. ReturnRotation in the base end_scan() handles the final rotation position. Affects all beamlines using TomoScanPSO: 2-BM, 7-BM, 13-BM, 32-ID. --- tomoscan/tomoscan_pso.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tomoscan/tomoscan_pso.py b/tomoscan/tomoscan_pso.py index c9249a0e..4975b1f0 100644 --- a/tomoscan/tomoscan_pso.py +++ b/tomoscan/tomoscan_pso.py @@ -140,7 +140,11 @@ def end_scan(self): # Set the rotation speed to maximum self.epics_pvs['RotationSpeed'].put(self.max_rotation_speed) - # Move the sample in. Could be out if scan was aborted while taking flat fields + # Move the sample in (X/Y stage only). Could be out if scan was aborted while + # taking flat fields. Clear self.rotation_save first so that move_sample_in() + # does not restore the rotation to the end-of-scan angle — ReturnRotation in + # the base end_scan() handles the final rotation position. + self.rotation_save = None self.move_sample_in() # Call the base class method