add support for CSR NPZ decompression for EigerImageSeries#899
Merged
add support for CSR NPZ decompression for EigerImageSeries#899
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #899 +/- ##
==========================================
+ Coverage 69.41% 69.55% +0.14%
==========================================
Files 148 149 +1
Lines 22590 22586 -4
==========================================
+ Hits 15680 15709 +29
+ Misses 6910 6877 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
psavery
reviewed
Feb 27, 2026
| block_size = orig_size | ||
| block_size_bytes = block_size.to_bytes(4, "big") | ||
| # Compress the data | ||
| compressed = lz4.block.compress(arr_bytes, store_size=False) |
Collaborator
There was a problem hiding this comment.
I guess lz4 is being imported automatically here via the pytest.importorskip on line 58. I wonder if we should import it explicitly in this function?
Collaborator
Author
There was a problem hiding this comment.
Good catch. I must have messed that up when I added the skips. I moved the pytest importorskip into that function so we have a more sensible import.
…ck so we don't rely on accidental imports.
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.
Overview
To minimize the overall bandwidth necessary during collection of Eiger images, we are optionally storing them as NPZ serializations of scipy's CSR matrix (save_npz). This can be substantially smaller amounts of data. However, the HEXRD Eiger image series adapters do not support this compression format. They currently only support "lz4" and "bslz4", which come right off of the Eiger and are decompressed through their compression/decompression algorithms.
This PR adds support for loading CSR NPZ compressed images when using the Eiger V1 or V2 image series adapters.
The core of this change is the following:
This will be used to decompress the image if the compression type is "csrnpz".
Test Cases
Tests were added to address the following cases:
Note: these examples are all synthetically generated, but have been validated against real data sets in manual testing. For the synthetic generation, we don't try to emulate BSLZ4 compression because it is unnecessarily complex and poor ROI.
Affected Workflows
Anyone loading Eiger images could be impacted. However, no existing functionality has been changed.
Documentation Changes
As there are no existing documentation artifacts for the Eiger Adapters, this PR will not modify documentation.