Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sparsing from eiger stream files #709

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

psavery
Copy link
Collaborator

@psavery psavery commented Aug 18, 2024

This fixes a few issues with creating sparse frame-cache arrays from eiger-stream-v1 files:

  1. The dtype is now read correctly from the HDF5 file
  2. Fixed treatment of arrays with empty shapes in the yaml dumper NumpyToNativeDumper
  3. Save the nested eiger metadata as a yaml string, since frame caches do not yet support nested metadata

Unfortunately, since h5py 3 came out, it no longer automatically
converts string types to strings, and we have to do it manually. We
need to use the `h5py_read_string()` compatibility function to do
so.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Calling `tolist()` on these types of arrays yields a single number
rather than a list. This would cause errors with the yaml dumper since
it was expected a list.

Instead, we should just follow the route for single numbers and call
`.item()` instead. This fixes the issue.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Because the numpy frame-cache format does not yet support nested
metadata structures, we cannot save nested metadata as a frame-cache
without causing errors.

We have some potential solutions to support nested metadata on the
horizon. Until that time, let's store the eiger stream metadata as
a yaml string, so that sparse arrays can actually be created from it.
The metadata is still present, it is just in the form of a yaml string.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 33.49%. Comparing base (433a0d5) to head (d9ba404).

Files Patch % Lines
hexrd/imageseries/load/eiger_stream_v1.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
- Coverage   33.49%   33.49%   -0.01%     
==========================================
  Files         129      129              
  Lines       21237    21242       +5     
==========================================
+ Hits         7113     7114       +1     
- Misses      14124    14128       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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