Files
csaxs_bec/bin/debug
menzelandClaude Opus 5 f0f8f620de
CI for csaxs_bec / test (push) Successful in 1m45s
debug: report the achieved geometry, and catch stalls that keep a full span
The first clean run said both scans were fine, which conflicts with scan 473
being classified as having the artefact. Two gaps explain how that verdict
could be wrong.

**The file was never checked against the intended scan.** Measured fast-axis
travel implies roughly 6.2 um per point in S00473 and 9.2 um in S00254, while
the scans were run at 0.65 um and 1.00 um -- both about 9.3x larger. Until that
is resolved the analysis rests on an unverified assumption about which axis is
which and in what units. The check now prints the fast and slow axis ranges,
the per-line slow step, and the implied step size, so the file can be compared
directly against the scan command. A mismatch means the wrong axis, the wrong
units, or motion that was not commanded, and all three matter more than
anything downstream.

**Whole-line spans cannot see a partial stall.** An axis that freezes part-way
through a line and then continues still covers its full range, so the span test
passes. Since the report describes intermittent motion loss rather than whole
lines going missing, that is the more likely shape of the fault. Lines are now
also scanned for runs of consecutive position samples that did not advance,
reported with the same start/middle/end distribution.

Verified against a file whose stalls leave every span intact: the span test
sees nothing, the new one finds all eight and places them in the final tenth.

Note the sampling limit still applies -- 74 position samples against 428 data
points in S00473, and about 8 against 205 in S00254. A stall shorter than the
sampling interval remains invisible, so a clean result here is not proof.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 12:24:01 +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.