Skip to content

BUG: flyscan master file missing /entry/flyscan_data/ group#14

Merged
prjemian merged 1 commit into
mainfrom
fix/nexus-detector-ndattributes-path
Jun 24, 2026
Merged

BUG: flyscan master file missing /entry/flyscan_data/ group#14
prjemian merged 1 commit into
mainfrom
fix/nexus-detector-ndattributes-path

Conversation

@prjemian

Copy link
Copy Markdown
Contributor

Problem

A flyscan finished but its master file had no /entry/flyscan_data/
group, leaving only the lossy CA-monitor frame mapping (e.g. 14 frames
mapped where 21 were expected). The session log showed:

W flyscan._main: per-frame pairing failed for /entry/flyscan_data ...:
KeyError("AD file '...' has no dataset
'/entry/instrument/NDAttributes/NDArrayTimeStamp'"). The group will not be written.

Root cause

The AD-file pairing reads per-frame NDArrayTimeStamp / NDArrayUniqueId
from /entry/instrument/NDAttributes/..., but all 3-ID-C area detectors
write NDAttributes one group level deeper, inside the NXdetector group:
/entry/instrument/detector/NDAttributes/.... The KeyError aborted the
pairing, so write_flyscan_data never ran and the group + /entry@default
were never written. The detector file itself was complete (25 valid
frames with timestamps/UIDs) — only the lookup path was wrong.

This single bug explains both user complaints: the AD-file pairing exists
specifically to bypass the known CA-monitor coalescing loss, so when it
aborted, only the degraded CA mapping remained.

Changes

  • Correct the NDAttributes default path to /entry/instrument/detector/...
    in three helpers: pair_frames_to_positions_from_ad_file,
    _expected_frame_count, and _ad_frame_count.
  • Update synthetic AD-file test fixtures to the same detector/ layout.
  • Document the area-detector NeXus layout invariant in AGENTS.md.
  • Make the four "flyscan_data NOT written" outcomes conspicuous: promote
    WARNING -> ERROR and wrap each message in a banner. The console handler
    is intentionally terse (shows only the level's first letter), so the
    original warning was easily overlooked amid INFO chatter.

Verification

Full test suite passes (119 passed). Off-network host, so no live EPICS
exercised.

Not addressed here

The detector over-acquired (25 frames vs 21 expected) during
deceleration. Separate behavior; did not cause the missing group.

The per-frame timestamp/UID datasets are read from the wrong HDF5 path,
so /entry/flyscan_data is never written and the master file is left with
only the lossy CA-monitor frame mapping.

All 3-ID-C area detectors write NDAttributes under the NXdetector group
at /entry/instrument/detector/NDAttributes/, not /entry/instrument/
NDAttributes/.  Correct the default dataset paths in the AD-file pairing,
expected-frame-count, and repair helpers; update the synthetic test
fixtures to the same layout; and document the NeXus layout invariant in
AGENTS.md.

Also make the "flyscan_data NOT written" outcomes conspicuous: promote
the four affected log records from WARNING to ERROR and wrap each message
in a banner, since the terse console handler shows only the level's first
letter and the warning was easily missed amid INFO chatter.
@prjemian prjemian merged commit 0230eae into main Jun 24, 2026
5 checks passed
@prjemian prjemian deleted the fix/nexus-detector-ndattributes-path branch June 24, 2026 22:06
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28132554098

Coverage increased (+0.01%) to 64.764%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (10 of 14 lines covered, 71.43%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/id3c/plans/flyscan_3idc.py 5 1 20.0%
Total (4 files) 14 10 71.43%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2645
Covered Lines: 1713
Line Coverage: 64.76%
Coverage Strength: 0.65 hits per line

💛 - Coveralls

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