Repository navigation
Conversation
…nversion NumPy 2.0 removed implicit conversion of non 0-d arrays to Python scalars, so int()/float() on a size-1 array now raises "TypeError: only 0-dimensional arrays can be converted to Python scalars". Serpent scalar metadata (and single fission-yield lookups) are parsed into size-1 arrays, so ResultsReader._cleanMetadata and several MicroXSReader conversions broke under NumPy >= 2.0. This fails the majority of the test suite on current runners. Unwrap size-1 arrays via .item() before converting. Behavior is unchanged on older NumPy (int()/float() on a size-1 array already returned the scalar there). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
This should be handled in #543 |
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.
Problem
CI is red on current runners across all supported Python versions. The bulk of the failures (≈53 of 58 per job) are a single root cause:
The last green
mainrun predates the NumPy 2.0 rollout onubuntu-latest; any run today hits this. It reproduces on a cleanmaincheckout with NumPy 2.5.1 / Python 3.13, so it is independent of any feature branch — it blocks every open PR's CI.Root cause
NumPy 2.0 removed implicit conversion of non 0-d arrays to Python scalars. Serpent scalar metadata (and single fission-yield lookups) are parsed into size-1 arrays, so
int(...)/float(...)on them now raises. Affected sites:ResultsReader._cleanMetadata— hit by nearly every test that reads a_res.mfileMicroXSReaderfission-yield parsing (parent id, energy, and thegetFYlookup)Fix
Unwrap size-1 arrays with
.item()before converting. Behavior is unchanged on older NumPy, whereint()/float()on a size-1 array already returned the scalar.Testing
Full suite on
main+ this fix (Python 3.13, NumPy 2.5.1, withscipy/pandasinstalled):36 failed, 29 errors346 passed, zero scalar-conversion errorsNot covered here
A handful of
matplotlibimage-comparison tests still fail on current runners due to baseline-PNG drift against newer matplotlib. That is a separate, pre-existing issue (unrelated to NumPy) and is intentionally left out of this PR — filed separately for maintainer triage.