Files
csaxs_bec/bin/debug
menzelandClaude Opus 5 95409036bb
CI for csaxs_bec / test (push) Successful in 1m42s
debug: measure lines against the slow axis, and stop hiding the MCS
Two faults visible in the run against S00473 and S00254.

**Bug 1 reported nothing at all.** Candidates were restricted to the
`monitored` readout group, but the MCS channels -- which are the per-point scan
data, 203 x 428 = 86884 for S00473 -- are not in it. The filter excluded exactly
the arrays the check exists to examine, so both tables came out empty. The
restriction is gone; positions are still skipped, by ramp shape rather than by
group membership.

**Bug 2 could not find a line structure in S00473.** The monitored stream is
sampled while the line runs, so samples per line vary and the trace does not
reshape into a rectangle; requiring the sample count to divide evenly rejected
it outright. Segmentation now works from the boundaries themselves and tolerates
ragged lines.

That fix alone was not enough, and the reason matters. A line whose motion
failed produces no flyback, so it merges into its neighbour and the merged
segment shows a full, healthy span: **the stall erases the evidence of itself.**
Testing against ragged data with four stalls, the fast axis yielded 103 segments
for 107 lines and pronounced them all consistent.

So lines are now delimited by the **slow** axis, which steps once per line
whatever the fast axis did and stays a valid ruler across a stall. With that,
the same file gives exactly 107 segments and all four stalls, correctly reported
as clustering in the final tenth of the scan.

Where several positioner traces exist, the one with the largest travel per line
is taken as the fast axis and the runners-up are listed with their spans, so a
wrong pick is visible rather than silent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 12:14:31 +02:00
..

Debug scripts

Throwaway diagnostics for investigating beamline problems. Not part of the plugin: nothing here is imported by csaxs_bec, and none of it needs BEC or a venv beyond the libraries each script names.

Kept on the debug/scan-artefacts branch rather than main so that a half-finished diagnostic never reaches a production checkout. Promote anything that turns out to be generally useful; delete the rest once the question it answered is settled.

scan_artefact_check.py

Desk check for the July 2026 commissioning scan artefacts reported by Andreas Apseros and Kazu Hirosawa. Read-only — opens BEC master files and writes nothing.

python3 scan_artefact_check.py --root /sls/x12sa/data/p23080/raw/data \
        --scan 473 --scan 450 --scan 411 --scan 254

Answers two questions without beam:

  • end-of-line intensity — is the last point of every line systematically weaker, and is the first point affected too (which would mean a different mechanism)?
  • dropped line motion — did the fast axis actually travel on every line? A line whose span collapsed is motion that did not happen while the scan still reported success.

Include a known-clean scan (254) so a null result distinguishes "this scan was fine" from "the analysis is wrong".

Run --list first if anything looks off; it dumps the file structure.

The motion check reads the fast-axis readback. If that axis is an open-loop stepper with no encoder, the readback is the commanded position and lost steps are invisible: a collapsed span still proves failure, but a healthy span proves nothing.