Skip to content

feat: add read/write support #167

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

feat: add read/write support #167

wants to merge 1 commit into from

Conversation

henryiii
Copy link
Member

@henryiii henryiii commented Apr 25, 2025

Adding read/write support, hdf5 support pulled from scikit-hep/boost-histogram#997. Zip and JSON support added as well. Libraries supporting the UHI schema can simply produce or consume a Python object following the schema and then use the utilities in uhi.io to read or write to all the formats we implement.

This also makes a clarification to the schema:

  • The storage format needs to support ND Arrays, so that's explicitly shown as nested lists now in the schema. For interlibrary communication, it must support np.asarray.

Each format remains as flexible as possible by expecting the user to do a little setup; you can store anywhere in an HDF5 file via groups. You can write to an existing zip file, control the compression, etc. by using a Zipfile object.

I'm using the JSON format to store tests, then converting them to the binary formats (HDF5 and Zip) and then testing that the files are correct and can be read back.

Co-authored-by: Aryaman Jeendgar <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
@APN-Pucky
Copy link
Member

I just want to drop a comment and I am not very familiar with hdf5: YODA-2.1.0 supports hdf5 since the latest release https://yoda.hepforge.org/. For me it will be interesting if/how the UHI-hdf5 interoperates with YODA-hdf5 as part of https://github.com/APN-Pucky/babyyoda.

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