Skip to content

Both plans now determine scan type based on ScanType enum. Tomography adds demo_tomography - #54

Merged
tomkane-dls merged 10 commits into
mainfrom
boolean_spec_choice
Oct 20, 2026
Merged

tomkane-dls merged 10 commits into
mainfrom
boolean_spec_choice

Conversation

@gkalua

@gkalua gkalua commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

updates plan to determine scan type based on enum choice passed from the UI frontend with accompanying tests.

The scope of this PR has simplified - changes:

  • Both experiments start by calling demo_() explicitly with a scan_type enum.
  • the same scan can now be run as step or fly
  • tomography plans layout now mirrors spectroscopy plans

@gkalua
gkalua requested review from tomkane-dls and a balanced review from Copilot October 16, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing callers remain incompatible, the step-scan assertion expects incorrect dimensions, and velocity validation ignores custom trajectories.

3 open findings
What changed in this PR

Updates spectroscopy scans to use an explicit scan-type enum supplied by the frontend instead of automatic mode selection.

Changes:

  • Adds ScanType and requires it in the spectroscopy plan.
  • Consolidates demo grid parameters into spectroscopy and adds fly-scan velocity validation.
  • Adds system tests for explicit step and fly scans.
File Description
tests/​system_tests/​test_plans_system.py Adds explicit scan-mode system tests.
src/​test_rig_bluesky/​spectroscopy_plans.py Consolidates plans and introduces enum-based scan selection.
src/​test_rig_bluesky/​plans.py Defines the shared ScanType enum.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +54 to +55
*,
scan_type: ScanType,
Comment on lines +60 to +61
xsteps = int(round(math.sqrt(total_number_of_scan_points)))
velocity = grid_size / (xsteps * exposure_time)

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.

I see what copilot is saying, We have moved the guard from demo_spectroscopy onto spectroscopy, but technically this guard assumes a square grid to calculate max velocity which isn't necessarily true if you called a different spec. So by adding this guard here we are not allowing legitimate fly scans to happen here, so i think we may need to make a more intelligent guard. I am not sure how likely we are to be calling scans not from the UI currently?

timeout=20,
)

assert events["FINISHED"][0]["scanDimensions"] == [5]
"Performing a fly scan. Estimated velocity: %.2f mm/s.",
velocity,
)
else:

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.

I think i would prefer the explicit, and still exhaustive
if scan_type == ScanType.STEP:
to be clear

@tomkane-dls

Copy link
Copy Markdown
Contributor

For now I’d suggest we drop the hard velocity guard from spectroscopy and only log a warning. The current check assumes the square grid the UI builds, so it can wrongly reject a valid fly scan when a different spec is passed in. ophyd-async already enforces each motor’s VMAX when it builds the pmac trajectory during prepare, so an unsafe scan will still be refused. We can add a true velocity guard after building the actual scan spec later.

@tomkane-dls tomkane-dls changed the title updates plan to determine scan type based on enum choice Both plans now determine scan type based on ScanType enum. Tomography adds demo_tomography Oct 19, 2026
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.70%. Comparing base (ea87af1) to head (33713e9).

Files with missing lines Patch % Lines
src/test_rig_bluesky/tomography_plans.py 0.00% 13 Missing ⚠️
src/test_rig_bluesky/spectroscopy_plans.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
+ Coverage   48.35%   50.70%   +2.34%     
==========================================
  Files           5        5              
  Lines         213      213              
==========================================
+ Hits          103      108       +5     
+ Misses        110      105       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tomkane-dls
tomkane-dls self-requested a review October 20, 2026 08:41
@tomkane-dls
tomkane-dls merged commit eace3a3 into main Oct 20, 2026
7 of 8 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.

3 participants