Feat/fil comb #306

Merged
menzel merged 4 commits from feat/fil-comb into main 2026-08-30 12:58:16 +02:00
Member
No description provided.
menzel added 4 commits 2026-08-30 12:51:54 +02:00
fil_trans selects by transmission, which is the wrong tool when a
particular foil is wanted: it optimises against the thickness table and
which combination wins is not something to rely on. The alternative was
four hand-copied stage coordinates, where the out positions differ per
unit (25.0 / 25.5 / 25.8 / 25.0) and getting one wrong leaves the stage
off any tabulated slot -- _fil_trans_report matches within 0.1, so the
combination then reports as unidentified.

fil_comb takes one slot number per unit, 1..6 with 1 = out, as the SPEC
fil_comb did, and looks the coordinates up. It reuses
_position_transmission, _print_combination and _execute_combination
unchanged, so it reports and moves exactly as fil_trans does, including
the dry run and the default-yes prompt.

Every slot is validated before the safety prompt is reached, so a typo
raises rather than putting a question about an unexecutable combination
in front of someone. Disabled slots -- Fe5 and the redundant opens --
raise too: _all_combinations skips them, so fil_comb must refuse them
rather than move somewhere fil_trans would never choose.

_attenuation_allowed is added here but not yet wired into fil_trans;
that is the next commit, so this one cannot change existing behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kLGTqTyXzTT4swt3CfTkV
The DMM-through / CCM-active check now lives in _attenuation_allowed and
fil_trans calls it, so there is one copy rather than two drifting ones.
A guard that is duplicated is a guard that gets fixed in one place only.

Behaviour is unchanged: the same three PVs are read with the same
fallbacks, the same warning is printed, the same default-NO prompt is
raised through OMNYTools.yesno, the same "Safe fallback" of refusing
when no prompt is available applies, and fil_trans(1) still bypasses the
check entirely.

Split from the previous commit so that this half can be reverted on its
own if it misbehaves at the beamline, without taking fil_comb with it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kLGTqTyXzTT4swt3CfTkV
Two ways the filter table disagreed with filter.mac rev 1.19.

The Si thicknesses were nominal where spec used values measured at
18.58 keV: 400/200/3200/100/1600/800 against 345.6/234.6/3303/137.5/
1661.5/833.8. Si100 vs Si137.5 is 37% out, and at 17 keV the pair
Si200+Si1600 gives T=0.060 where the measured Si234.6+Si1661.5 gives
0.052 -- a 16% error, larger than any distinction the search was trying
to make between neighbouring combinations.

The Zr and Cu calibration foils were selectable. filter.mac flagged them
disabled so that selection by transmission could not pick them, and at
17 keV fil_trans(0.05) duly returned 5246 -- a combination built on the
Zr foil, 1 keV below its K edge, where its transmission moves with any
small change in energy.

They are excluded through a new _EXCLUDE_FROM_SEARCH rather than by
clearing their 'enabled' flag, because those two things are not the same
and the flag is load-bearing elsewhere: _fil_trans_report substitutes
T=1.0 for a disabled position, so clearing the flag would have made the
report silently ignore a foil parked in the beam -- precisely the state
an edge scan puts it in. The foils stay enabled, stay addressable via
fil_comb as they were in spec, and are skipped only by the automatic
search.

At 17 keV fil_trans(0.05) now returns 2146 (Si345.6 + Ti200 + Ti20,
T=0.0494) and fil_trans(0.01) returns 2234 (T=0.0099), both matching an
independent calculation over the same CXRO tables.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kLGTqTyXzTT4swt3CfTkV
feat(filters): accept fil_comb(1411) as well as fil_comb(1, 4, 1, 1)
CI for csaxs_bec / test (pull_request) Successful in 1m41s
Read the Docs Deploy Trigger / trigger-rtd-webhook (push) Successful in 2s
CI for csaxs_bec / test (push) Successful in 1m52s
d120740dbb
The four-digit code is already the currency of this module: it is what
_all_combinations builds, what fil_trans prints as the selected
combination, and what _fil_trans_report prints for what is currently in
the beam. Requiring commas on the way back in meant reading a code off
the screen and retyping it as four separate arguments.

fil_comb now takes 1411, "1411", (1, 4, 1, 1) or [1, 4, 1, 1], so a
reported combination can be pasted straight back.

A code of the wrong length is rejected with the length it needs rather
than falling through to "expects 4 positions, got 1", which was the
unhelpful error a code would have produced before. bool is excluded from
the integer branch so fil_comb(True) does not quietly become "True".
Digits outside 1..6 are left to the existing per-unit range check, which
names the offending unit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kLGTqTyXzTT4swt3CfTkV
Author
Member

Adds fil_comb, a command to set an explicit filter combination, and corrects two disagreements between the plugin's filter table and filter.mac rev 1.19.
Behavioural change: fil_trans will select different combinations than before, because both the Si thicknesses (nominal → measured, up to 37% out on one slot) and the candidate set (Zr/Cu calibration foils excluded from automatic selection) have changed. A transmission target reproduced from an older logbook entry will not necessarily land on the same filters. At 17 keV, fil_trans(0.05) returns 2146 where it previously returned 5246 — the latter built on the Zr foil, 1 keV below its K-edge.
fil_comb takes one slot number per unit (fil_comb(1, 4, 1, 1)) or the four-digit code that fil_trans prints (fil_comb(1411)), enforces the same DMM/CCM interlock as fil_trans, and dry-runs by default. Calibration foils remain addressable through it, as they were in spec.

Adds fil_comb, a command to set an explicit filter combination, and corrects two disagreements between the plugin's filter table and filter.mac rev 1.19. Behavioural change: fil_trans will select different combinations than before, because both the Si thicknesses (nominal → measured, up to 37% out on one slot) and the candidate set (Zr/Cu calibration foils excluded from automatic selection) have changed. A transmission target reproduced from an older logbook entry will not necessarily land on the same filters. At 17 keV, fil_trans(0.05) returns 2146 where it previously returned 5246 — the latter built on the Zr foil, 1 keV below its K-edge. fil_comb takes one slot number per unit (fil_comb(1, 4, 1, 1)) or the four-digit code that fil_trans prints (fil_comb(1411)), enforces the same DMM/CCM interlock as fil_trans, and dry-runs by default. Calibration foils remain addressable through it, as they were in spec.
menzel merged commit d120740dbb into main 2026-08-30 12:58:16 +02:00
menzel deleted branch feat/fil-comb 2026-08-30 13:12:12 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bec/csaxs_bec#306