Repository navigation
fix: read complete event rows from LHEH5 datasets - #437
Merged
APN-Pucky merged 1 commit intoNov 12, 2026
Merged
Conversation
Physical HDF5 chunks can split event columns and cannot iterate an empty dataset. Read complete rows using the row-chunk extent, retaining the 8192-row contiguous fallback. Cover event content and ordering across storage layouts, compressed and uncompressed empty-file roundtrips, and lazy row-batched reads. AI assistance: Codex helped investigate, implement and test this change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #437 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 972 968 -4
=========================================
- Hits 972 968 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the LHEH5 reader changes addressing column-chunked datasets and empty files.
No open issues 🎉
What changed in this PR
Fixes LHEH5 event reading to handle datasets chunked across columns and empty files while preserving lazy, batched reads.
Changes:
- Reads complete event rows using the chunk’s row extent, retaining the 8192-row fallback for contiguous datasets.
- Adds regression coverage for storage layouts, empty-file roundtrips, and lazy batch reading.
| File | Description |
|---|---|
tests/test_lheh5_writer.py |
Adds layout, empty-file, and lazy-reading regression tests. |
src/pylhe/lheh5.py |
Replaces physical chunk iteration with complete-row batches and removes the unused NumPy import. |
Review effort: Balanced
Member
|
LGTM, I did not know there could be chunks like (2,3). Thanks! |
APN-Pucky
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read_iter_eventstreats each physical HDF5 chunk as a complete event row. When/eventsis chunked across columns, a slice such aschunks=(2, 3)supplies only part of each row, so event fields can be wrong and iteration can fail. An empty file produced by the public writer also fails becauseiter_chunks()rejects the zero-row selection.Read complete rows in batches using the chunk's row extent, retaining the existing 8192-row fallback for contiguous datasets. This also lets empty datasets yield no events without entering the batch loop.
Validation on Python 3.12.15, NumPy 2.5.4 and h5py 3.16.0:
git diff --checkpass.AI assistance: I used Codex to investigate the defect, prepare the implementation and tests, and run the checks.
The five fork workflows currently need maintainer approval. Could a maintainer authorize them?