Skip to content

Tomography: restart Kinetix preview once at the end of step scans, not per step - #147

Merged
Jakub Wlodek (jwlodek) merged 3 commits into
NSLS2:mainfrom
sligara7:flyscan-preview-optional
Nov 10, 2026
Merged

Jakub Wlodek (jwlodek) merged 3 commits into
NSLS2:mainfrom
sligara7:flyscan-preview-optional

Conversation

@sligara7

@sligara7 Anthony Sligar (sligara7) commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Restart detector preview once at the end of a tomography scan, not after every step of it.

  • tomo_flyscan and tomo_dark_flat take restart_preview: bool = True (beside use_shutter); run on their own they still return the cameras to preview.
  • tomo_nd_step_scan and its wrappers (tomo_flyscan_loop, tomo_1d_step_scan, tomo_2d_step_scan) run them with restart_preview=False, and restart preview once when the whole scan ends (also on abort), unless restart_preview=False.
  • tomo_dark_flat still restores each camera's exposure either way.
  • enable_preview_mode supports the Phantom: it stops a recording and turns on live preview (Preview). The Phantom's prepare turns live preview off, since the IOC (ADPhantom afefafc) refuses to download while it runs.

Verification

Mock tests only (no sim, TST or beamline):

  • tests/tomography and tests/detectors/test_phantom.py: pass; the new or updated tests fail on the code before each change.
  • Unit suite (tests, excluding tests/gui): 562 passed, exit 0.
  • pyright 0 errors; pre-commit passed.

Adds restart_preview (default False). The cleanup no longer puts Kinetix detectors back into continuous, internally triggered acquisition unless asked.

Assisted-by: copilot:claude-opus-5-5

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Adding restart_preview before sample_name breaks existing positional calls, losing sample metadata, unexpectedly enabling preview, and shifting subsequent arguments.

1 open issue
What changed in this PR

This PR makes Kinetix preview restart optional after tomo_flyscan, leaving detectors in their post-scan state by default.

Changes:

  • Adds restart_preview=False and gates preview cleanup on this option.
  • Preserves shutter closure, motor stopping, and velocity restoration.
  • Updates default-behavior assertions and adds a test for explicitly restarting preview.
File Description
tests/​tomography/​test_flyscans.py Tests default cleanup behavior and explicit preview restart.
src/​hextools/​tomography/​flyscans.py Adds and documents the preview-restart option and conditional cleanup.

Review effort: Balanced

Comment thread src/hextools/tomography/flyscans.py Resolved
@nghia-vo

Copy link
Copy Markdown
Collaborator

For tomo_flyscan only it should be set to True be default. Only in tomo_nd it sets to False

tomo_flyscan and tomo_dark_flat take restart_preview (default True). tomo_nd_step_scan and its wrappers run them with restart_preview=False and restart preview once when the whole scan ends, unless restart_preview=False. Per Jakub and Nghia's review.

Assisted-by: copilot:claude-opus-5-5
@sligara7 Anthony Sligar (sligara7) changed the title tomo_flyscan: make restarting Kinetix preview optional, off by default Tomography: restart Kinetix preview once at the end of step scans, not per step Nov 10, 2026
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:41
@sligara7

Copy link
Copy Markdown
Contributor Author

Done in 92ea2c2: tomo_flyscan (and tomo_dark_flat) default to restart_preview=True; tomo_nd_step_scan runs them with False and restarts preview once at the end.

@jwlodek Jakub Wlodek (jwlodek) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor point, otherwise looks good.

Comment thread src/hextools/tomography/flyscans.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Abort-path preview restoration lacks coverage with a mock Kinetix detector, since existing tests either complete normally or skip the relevant cleanup.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread src/hextools/tomography/flyscans.py Resolved
@nghia-vo

Copy link
Copy Markdown
Collaborator

restart_preview parameter needs to be used in tomo_nd, 1d_2d where we set to False for the loop. But at the end we set it to True.

enable_preview_mode stops a Phantom recording and turns on its live preview (ADPhantom Preview, deployed afefafc). The Phantom's prepare turns live preview off, since the IOC refuses to download while it runs. The tomography plans call enable_preview_mode for every detector. Per Jakub's review.

Assisted-by: copilot:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Phantom recording, preview, and download sequencing depends on ADPhantom afefafc behavior that mocks cannot verify, requiring IOC or detector-owner validation of safe shutdown and restart timing.

1 open issue

Review effort: Balanced

@jwlodek
Jakub Wlodek (jwlodek) merged commit f1aa3bc into NSLS2:main Nov 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants