Summary
When SampleOutAngleEnable is set to Yes and FlatFieldMode is set to End or Both,
the rotation stage performs two unnecessary extra moves at the end of the scan.
Affected beamlines
All IOCs whose scan class inherits from TomoScanPSO or TomoScanFPGAPSO:
- 2-BM (
tomoscan_2bm.py, tomoscan_helical.py, tomoscan_fpga_2bm.py)
- 7-BM (
tomoscan_7bm.py via TomoScanHelical)
- 13-BM (
tomoscan_13bm_pso.py)
- 32-ID (
tomoscan_32id.py, tomoscan_fpga_32id.py)
Steps to reproduce
- Set
SampleOutAngleEnable = Yes and SampleOutAngle to any angle (e.g. 90°)
- Set
FlatFieldMode = End or Both
- Set
ReturnRotation = Yes
- Run a fly scan (e.g. 0° → 180°)
Observed behavior
After the post-scan flat fields are collected the rotation stage moves:
SampleOutAngle (90°) → rotation_stop (180°) → rotation_start (0°)

The intermediate move to 180° is spurious and causes the back-and-forth motion.
Scenario (step-by-step)
| Step |
What happens |
self.rotation_save |
Rotation position |
| 1 |
Fly scan finishes |
— |
180° (rotation_stop) |
| 2 |
collect_flat_fields() → move_sample_out() saves position and moves to SampleOutAngle |
180° |
90° |
| 3 |
Flat frames collected |
180° |
90° |
| 4 |
end_scan() calls move_sample_in() → restores self.rotation_save |
180° |
180° ← spurious |
| 5 |
Base end_scan() applies ReturnRotation = Yes → moves to rotation_start |
180° |
0° |
Result: the rotation travels 90° → 180° → 0° instead of simply 90° → 0°.
Root cause
end_scan() in tomoscan_pso.py (and identically in tomoscan_fpga_pso.py) calls
move_sample_in() to bring the X/Y stage back into the beam after flat fields. However,
move_sample_in() also restores the rotation motor to self.rotation_save, which at
that point holds the end-of-scan angle (180°) set by the preceding move_sample_out()
call during post-scan flat collection. This restore is immediately undone by
ReturnRotation in the base end_scan(), producing the spurious double move.
Summary
When
SampleOutAngleEnableis set toYesandFlatFieldModeis set toEndorBoth,the rotation stage performs two unnecessary extra moves at the end of the scan.
Affected beamlines
All IOCs whose scan class inherits from
TomoScanPSOorTomoScanFPGAPSO:tomoscan_2bm.py,tomoscan_helical.py,tomoscan_fpga_2bm.py)tomoscan_7bm.pyviaTomoScanHelical)tomoscan_13bm_pso.py)tomoscan_32id.py,tomoscan_fpga_32id.py)Steps to reproduce
SampleOutAngleEnable = YesandSampleOutAngleto any angle (e.g. 90°)FlatFieldMode = EndorBothReturnRotation = YesObserved behavior
After the post-scan flat fields are collected the rotation stage moves:
SampleOutAngle (90°) → rotation_stop (180°) → rotation_start (0°)

The intermediate move to 180° is spurious and causes the back-and-forth motion.
Scenario (step-by-step)
self.rotation_saverotation_stop)collect_flat_fields()→move_sample_out()saves position and moves toSampleOutAngleend_scan()callsmove_sample_in()→ restoresself.rotation_saveend_scan()appliesReturnRotation = Yes→ moves torotation_startResult: the rotation travels
90° → 180° → 0°instead of simply90° → 0°.Root cause
end_scan()intomoscan_pso.py(and identically intomoscan_fpga_pso.py) callsmove_sample_in()to bring the X/Y stage back into the beam after flat fields. However,move_sample_in()also restores the rotation motor toself.rotation_save, which atthat point holds the end-of-scan angle (180°) set by the preceding
move_sample_out()call during post-scan flat collection. This restore is immediately undone by
ReturnRotationin the baseend_scan(), producing the spurious double move.