Skip to content

Bug: Spurious rotation back-and-forth when collecting post-scan flat fields with SampleOutAngleEnable = Yes #177

Description

@decarlof

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

  1. Set SampleOutAngleEnable = Yes and SampleOutAngle to any angle (e.g. 90°)
  2. Set FlatFieldMode = End or Both
  3. Set ReturnRotation = Yes
  4. 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°

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions