-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for current RNTuple files (#962)
* Adds changes, but ignores some to keep the old tests passing for now. * style: pre-commit fixes * Adds changes to footer and skips old file tests with the exception of 0662. * style: pre-commit fixes * Adds new version of file for test 0662 and renames new test file to match pr nr. * Swaps rntuple file for new one form RNTuple in test 0662, the footer reading part should not complain anymore. * Applies changes to const file. * Adds new format test file. * style: pre-commit fixes * Tests only the new file for now. * style: pre-commit fixes * Adds new RNTuple schema for the footer and the split cases without the split functions. * style: pre-commit fixes * Updates testing / adds more files. * style: pre-commit fixes * Adds changes to split functionality. * style: pre-commit fixes * Fixes split for uint16 case. * style: pre-commit fixes * Fixes split for 32 and 64. * style: pre-commit fixes * Fixes spelling errors. * style: pre-commit fixes * Fixes spelling errors. * Changes zigzag function. * style: pre-commit fixes * Uses test files from skhep_testdata and removes local ones. * style: pre-commit fixes * Reverts changes to test_0662-rntuple-stl-containers.py * Vectorized split-decoding for 32 and 64-bits. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jim Pivarski <[email protected]> Co-authored-by: Jim Pivarski <[email protected]>
- Loading branch information
1 parent
fff5ebe
commit 6b1952e
Showing
5 changed files
with
160 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE | ||
|
||
import pytest | ||
import uproot | ||
import skhep_testdata | ||
import numpy as np | ||
|
||
|
||
def test_new_support_RNTuple_split_int32_reading(): | ||
with uproot.open( | ||
skhep_testdata.data_path("uproot_ntuple_int_5e4_629_01.root") | ||
) as f: | ||
obj = f["ntuple"] | ||
df = obj.arrays() | ||
assert len(df) == 5e4 | ||
assert len(df.one_integers) == 5e4 | ||
assert np.all(df.one_integers == np.arange(5e4 + 1)[::-1][:-1]) | ||
|
||
|
||
def test_new_support_RNTuple_bit_bool_reading(): | ||
with uproot.open(skhep_testdata.data_path("uproot_ntuple_bit_629_01.root")) as f: | ||
obj = f["ntuple"] | ||
df = obj.arrays() | ||
assert np.all(df.one_bit == np.asarray([1, 0, 0, 1, 0, 0, 1, 0, 0, 1])) | ||
|
||
|
||
def test_new_support_RNTuple_split_int16_reading(): | ||
with uproot.open( | ||
skhep_testdata.data_path("uproot_ntuple_int_multicluster_629_01.root") | ||
) as f: | ||
obj = f["ntuple"] | ||
df = obj.arrays() | ||
assert len(df.one_integers) == 1e8 | ||
assert df.one_integers[0] == 2 | ||
assert df.one_integers[-1] == 1 | ||
assert np.all(np.unique(df.one_integers[: len(df.one_integers) // 2]) == [2]) | ||
assert np.all(np.unique(df.one_integers[len(df.one_integers) / 2 + 1 :]) == [1]) |