Skip to content

feat: separate frame and fallback metadata - #168

Open
pecomyint wants to merge 2 commits into
mainfrom
perf/frame-metadata-provenance
Open

pecomyint wants to merge 2 commits into
mainfrom
perf/frame-metadata-provenance

Conversation

@pecomyint

Copy link
Copy Markdown
Collaborator

Goal

Keep frame-attached metadata separate from latest-value CA fallback so downstream analysis can tell what was measured with the frame. Also carry an explicit geometry revision when the stream supplies one.

Why

The combined metadata mapping remains for compatibility, but scientific consumers now have unambiguous provenance without copying or hashing full Q arrays.

Automated checks

  • focused reader/frame tests: 7 passed, 2 pvaccess-dependent tests skipped locally
  • ruff check src/dashpva/

Human test plan

  1. Open Area Detector or HKL3D and connect to a normal stream.
  2. Confirm images and metadata display exactly as before.
  3. Stop and reconnect once; confirm no stale frame or new error appears.
  4. If inspecting take_latest_frame(), confirm frame_attributes excludes CA fallback values and fallback_attributes contains only those fallback values.

No new CLI command or viewer control is added.

Refs #150.

@pecomyint
pecomyint requested a review from Osayi-ANL September 12, 2026 01:09

@Osayi-ANL Osayi-ANL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attributes duplicates the two new fields. It's frame_attributes plus fallback_attributes merged.

The size check bills arrays twice (frame_delivery.py:80), and capture() can duplicate them in memory (:82, :48).

Suggestion: derive attributes instead of storing it. Nothing in src/ reads it.

No impact on a real detector run, but worth fixing before merge.

@pecomyint

pecomyint commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Good catch—fixed in d99f231. FramePacket.attributes is now a derived read-only view over frame_attributes and fallback_attributes, so metadata arrays are frozen and counted only once while existing callers keep the same combined interface. Added a regression test proving the byte budget no longer double-counts a shared metadata array. Focused tests pass (8 passed, 1 skipped), Ruff passes, and git diff --check passes. Please re-review when CI completes.

@pecomyint
pecomyint requested a review from Osayi-ANL September 15, 2026 19:30
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