Skip to content

Add move_slits plan and a Slits tab in the GUI - #115

Merged
Anthony Sligar (sligara7) merged 2 commits into
NSLS2:mainfrom
sligara7:hex-move-slits-plan
Oct 27, 2026
Merged

Anthony Sligar (sligara7) merged 2 commits into
NSLS2:mainfrom
sligara7:hex-move-slits-plan

Conversation

@sligara7

@sligara7 Anthony Sligar (sligara7) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Adds move_slits(slits, horizontal_center, vertical_center, horizontal_gap, vertical_gap, relative=False) and a Slits tab next to Motors in the GUI.

  • Slits move as a pair by their center line and gap (Jakub). Only the values given move; a center move keeps the gap, and a gap move is symmetric about the center.
  • relative=True uses bps.mvr. Gaps move before centers, because both drive the same blades.
  • No kinematics redone in the plan: it uses the existing Slits gap/center signals.

Root cause behind Jakub's review comment:

  • Slits built its derived gap/center signals from each motor's user_readback.
  • A derived signal is only locatable when its raw inputs are, and readback signals are not. So bps.rd and bps.mvr raised TypeError, which is why the first version read the blades by hand.
  • The signals are now built from the Motor devices, which ophyd-async supports by design; the transform still receives readback values.
  • A new test, test_slits_gap_and_center_work_with_locating_plan_stubs, pins bps.rd/bps.mvr on both axes. I observed it fail before the fix.
  • Note: bps.mvr moves relative to the motors' setpoints, as for any motor.

Verification: mock tests only; not run on the beamline.

  • move_slits: absolute, relative and gap-before-center moves, and an empty call refused. The existing slit kinematics and watcher tests still pass.
  • The GUI form (offscreen) builds the Slits device field, four optional floats and a relative checkbox.
  • move_slits is in the profile namespace.
  • ty adds no diagnostics.
  • Full suite on the first commit: 474 passed. The one failure, test_detector_viewer_axes, also fails on main in my dev env (older ntnda-qt-viewer than the lock).

Moves a slit pair by its center line and gap, as the slits are usually moved: only the values given move, a center move keeps the gap, a gap move is symmetric about the center, and relative=True shifts from the current positions. Gaps move before centers since both drive the same blades. Relative moves read the blade readbacks: bps.rd on the derived gap/center signals raises TypeError (readbacks are not locatable).

Assisted-by: copilot:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 27, 2026 20:43

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.

🟢 Approval recommended

The motion sequencing, exports, GUI integration, and regression coverage have no identified blocking issues.

No open issues 🎉

What changed in this PR

Adds a move_slits plan and a Slits GUI tab, making center and gap adjustments available through the existing plan interface.

Changes:

  • Supports selective absolute or relative adjustments, moving gaps before centers.
  • Exports the plan and adds it to the GUI.
  • Adds motion, GUI-field, and namespace tests, plus CLI documentation.
File Description
tests/​test_profile_namespace.py Checks that move_slits is exposed in the profile namespace.
tests/​photon_delivery_system/​test_slits.py Tests selective moves, sequencing, relative moves, and missing input.
tests/​gui/​test_plan_widget_slits.py Checks device selection and scalar fields in the Slits form.
src/​hextools/​photon_delivery_system/​slits.py Implements the move_slits plan.
src/​hextools/​photon_delivery_system/​__init__.py Exports move_slits publicly.
src/​hextools/​gui/​__main__.py Adds the Slits plan tab.
docs/​profile.md Lists the newly available plan.
docs/​cli.md Adds slit movement examples.

Review effort: Balanced

The derived gap/center signals took the motors' user_readback signals as raw inputs. A derived signal is only locatable when its raw inputs are, and readback signals are not, so bps.rd and bps.mvr raised TypeError on them. With the Motor devices as raw inputs they locate (the transform still receives readback values), and move_slits uses bps.mv / bps.mvr instead of recomputing the kinematics (Jakub, NSLS2#115). New test pins bps.rd and bps.mvr on every slit axis; observed failing before the fix.

Assisted-by: copilot:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 27, 2026 20:51

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.

🟢 Approval recommended

The focused implementation, integration, and test coverage are consistent, with no blocking issues identified; tests were not executed.

No open issues 🎉

Review effort: Balanced

@sligara7
Anthony Sligar (sligara7) merged commit 74a7048 into NSLS2:main Oct 27, 2026
6 checks passed
@sligara7
Anthony Sligar (sligara7) deleted the hex-move-slits-plan branch October 27, 2026 21:14
Anthony Sligar (sligara7) added a commit to sligara7/hextools that referenced this pull request Oct 27, 2026
# Conflicts:
#	docs/profile.md
#	src/hextools/gui/__main__.py
#	tests/test_profile_namespace.py
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.

2 participants