Skip to content

Read uint64 sample counts from hdr files#242

Open
robrui wants to merge 3 commits into
spectregrams:mainfrom
robrui:fix/hdr-uint64-counts
Open

Read uint64 sample counts from hdr files#242
robrui wants to merge 3 commits into
spectregrams:mainfrom
robrui:fix/hdr-uint64-counts

Conversation

@robrui
Copy link
Copy Markdown

@robrui robrui commented May 18, 2026

What does this PR do?

Update the _HdrFile reader to parse the new binary format where sample counts are stored as uint64_t instead of float32.

The initial implementation used np.frombuffer with offset= which reads continuously through the buffer, ignoring the 12-byte entry boundary. Fixed to use a structured np.dtype so each [value_float32, nsamples_uint64] entry is parsed correctly.

Issue link

#209

Checklist before merging

  • My commit history follows the conventional commits specification
  • Each commit represents a single, coherent unit of work
  • My changes are covered by unit tests
  • Unit tests successfully run locally
  • I have formatted Python code with black
  • I have checked static type hinting with mypy
  • I have added/updated necessary documentation, if required
  • I have checked for and resolved any merge conflicts
  • I have performed a self-review of my code

Additional notes

Companion to spectregrams/gr-spectre#24 which fixes the float32 overflow in the batched file sink. A local test script (3 cases: normal values, large sample count >2^24, extra bytes truncation) was verified against the new reader logic. The full pytest suite requires hardware-specific GNU Radio modules (gnuradio.sdrplay3) which are not available in the test environment.

robrui and others added 3 commits May 18, 2026 04:03
The batched file sink now writes tag sample counts as uint64_t
instead of float32. Update the Python reader to parse the new
12-byte-per-entry format.

Companion to spectregrams/gr-spectre#24.
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.

1 participant