-
Notifications
You must be signed in to change notification settings - Fork 39
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
Converting from scikit-hep histogram to Table #243
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3425353
Added reader and help functions to convert scikit-hep histogram to Ta…
yimuchen b6a0d9a
Updated documentation and dependencies
yimuchen 6ab8cb6
Fixing complaints from pylint
yimuchen 7ddb455
Added unit test for hist_utils functions
yimuchen ab99f26
Updating dependencies
yimuchen 67a9ad4
Expliciltly listing all dependencies
yimuchen 6ae8b03
Fixed pylint for test scripts
yimuchen a9783ee
Disabling specific pylint
yimuchen bab4364
Support for all standard hist.storage methods. Testing for all storag…
yimuchen da1740a
Additional edge cases handling
yimuchen 11ae275
Generalizing storage method detector to work for any input (compatibi…
yimuchen f7dcb33
Added additional handling for integer bins
yimuchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using this
try
-except
block here (and also below) in the first place? Does it ever fail? If so, you should know which kind of exception is thrown and use that. Please do not disable pylint warnings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is following the format that was found in
cfilereader
and other tests [1].Hm... I guess since the format parsing is pure python. I should actually remove the try/except all together, and simply have
pytest
handle the exception?[1] https://github.com/HEPData/hepdata_lib/blob/main/tests/test_cfilereader.py#L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK, I had forgotten that this is used elsewhere. I think also in https://github.com/HEPData/hepdata_lib/blob/main/tests/test_cfilereader.py#L48 it should actually not be used, but let's not worry about that here.
I'm wondering what
test_default_read
is meant to test. Canread_hist(TestHistUtils.base_hist)
actually fail? I would think that it can only happen if thehist.Hist()
interface changes. So I would think that you can just read in the file and get rid of thetry
-except
. However, there might be other ways that reading fails. For example, is it possible that an invalid hist is provided?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of the test function is to check if axis information is properly formatted into compatible lists (
hepdata_lib
basically wants everything to be in 1D list, so all axis information needs to be multiplied out)Technically, yes, the
read_hist
function can fail, as it depends on the storage format of the histogram entries [1], which can be user defined. For completeness’ sake, let me work on getting all official storage formats [2] into the package, and just have the function throw an error for user-defined formats for now.[1] https://github.com/yimuchen/hepdata_lib/blob/hist_reader/hepdata_lib/hist_utils.py#L39
[2] https://github.com/scikit-hep/hist/blob/main/src/hist/storage.py#L14