Skip to content

Add set_filters plan and a Filters tab in the GUI - #116

Merged
Anthony Sligar (sligara7) merged 3 commits into
NSLS2:mainfrom
sligara7:hex-set-filters-plan
Oct 28, 2026
Merged

Anthony Sligar (sligara7) merged 3 commits into
NSLS2:mainfrom
sligara7:hex-set-filters-plan

Conversation

@sligara7

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

Copy link
Copy Markdown
Contributor

Adds set_filters(...) and a Filters tab next to Motors in the GUI: one dropdown each for filter 1 upstream, filter 1 downstream and filter 2.

  • Each dropdown lists that filter's choices from filters.yml: pass through plus its configured materials, e.g. 6 mm Cu on filter 1 US, 6 mm Al on filter 1 DS, 1 mm Cu on filter 2. Empty slots are not offered. filters.yml stays the single source.
  • A filter left unset does not move; the chosen ones move together.
  • The filter devices are taken from the session namespace (ensure_available), so the form only shows the three dropdowns.
  • From the CLI: RE(set_filters(filter1_upstream_setting="6 mm Cu", filter2_setting="1 mm Cu")).

filters.yml materials updated from the 27-ID commissioning wiki ("FOE Filters" table). Before, filter 1 US was 12/9/6/3 mm SiC, and filter 1 DS slots 3–4 were 24/12 mm SiC, from the first filter config (2026-08-12). The wiki has:

  • filter 1 US: 6 mm Cu, 6 mm Al, empty, Bo-Hori.;
  • filter 1 DS: 4 mm Cu, 2 mm Cu, 6 mm Al, Bo-Ver.

Every motor position and limit already matched; only the labels changed. These labels are also what Filter.description records in run metadata. Jakub Wlodek (@jwlodek), please confirm the wiki is current.

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

  • The choices match filters.yml for each filter.
  • Only the chosen filters move, each to its configured position, on the real filters.yml devices mocked.
  • 6 mm Cu / 6 mm Al / 1 mm Cu on all three: each filter's recorded description matches.
  • An unknown material and an empty call are refused.
  • The GUI form (offscreen) has exactly three dropdowns with each filter's materials, and no device pickers.
  • set_filters is in the profile namespace.
  • Full suite: 474 passed. The one failure, test_detector_viewer_axes, also fails on main in my dev env (older ntnda-qt-viewer than the lock).
  • ty adds no diagnostics.

Sets filter 1 upstream, filter 1 downstream and filter 2 by material in one move; a filter left unset does not move. Each filter's choices (pass through plus its materials) come from filters.yml, so the GUI shows one dropdown per filter listing that filter's own materials, and the filter devices are taken from the session namespace.

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

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

No blocking issues were identified in the plan, GUI integration, exports, or focused tests; runtime tests were not rerun.

No open issues 🎉

What changed in this PR

Adds material-based filter control through a new set_filters plan and a Filters tab in the GUI, using filters.yml as the single source of available settings.

Changes:

  • Moves selected filters together while leaving unspecified filters unchanged.
  • Exposes three material dropdowns and resolves filter devices from the session namespace.
  • Adds plan and GUI tests, profile export coverage, and CLI documentation.
File Description
tests/​test_profile_namespace.py Checks that set_filters is available in the profile namespace.
tests/​photon_delivery_system/​test_filters.py Tests configured choices, selective movement, and invalid inputs.
tests/​gui/​test_plan_widget_filters.py Tests the three material dropdowns and absence of device pickers.
src/​hextools/​photon_delivery_system/​filters.py Implements configuration-derived settings and the set_filters plan.
src/​hextools/​photon_delivery_system/​__init__.py Exports set_filters.
src/​hextools/​gui/​__main__.py Adds the Filters tab beside Motors.
docs/​profile.md Lists set_filters among available plans.
docs/​cli.md Documents material-based filter commands.

Review effort: Balanced

…ed slots

filters.yml listed filter 1 US as 12/9/6/3 mm SiC and filter 1 DS slots 3-4 as 24/12 mm SiC (from the first filter config, 2026-08-12). The beamline's commissioning wiki (FOE Filters table) has filter 1 US = 6 mm Cu, 6 mm Al, empty, Bo-Hori. and filter 1 DS slots 3-4 = 6 mm Al, Bo-Ver.; all positions and limits already agreed. set_filters offers only slots with a material, so the empty slot is not a choice.

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

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

The revised material mappings control physical filter selection and recorded metadata, and still require beamline-owner confirmation beyond mock tests.

No open issues 🎉

Review effort: Balanced

# Conflicts:
#	docs/profile.md
#	src/hextools/gui/__main__.py
#	tests/test_profile_namespace.py
Copilot AI balanced review requested due to automatic review settings October 27, 2026 21:20

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

The revised material labels need beamline-owner confirmation against installed hardware because they determine movement choices and recorded metadata.

No open issues 🎉

Review effort: Balanced

@sligara7
Anthony Sligar (sligara7) merged commit ae92ec2 into NSLS2:main Oct 28, 2026
6 checks passed
@sligara7
Anthony Sligar (sligara7) deleted the hex-set-filters-plan branch October 28, 2026 19:18
Anthony Sligar (sligara7) added a commit to sligara7/hextools that referenced this pull request Oct 28, 2026
Keep both: the Slit Control tab and set_fe_slit1_aperture beside the Filters tab and set_filters.

Assisted-by: copilot:claude-opus-5-5
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