Skip to content

Numpy 2 Updates#125

Merged
asher-m merged 3 commits into
masterfrom
dev/numpy2
Jul 2, 2026
Merged

Numpy 2 Updates#125
asher-m merged 3 commits into
masterfrom
dev/numpy2

Conversation

@asher-m

@asher-m asher-m commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This PR includes many small changes to the tests to ensure numpy >= 2 compatibility. In particular, this PR addresses:

  • warnings/errors resulting from casting arrays ndim > 0 to scalar
  • some small name changes in numpy 2
    • e.g., np.Inf (which was always an alias for np.inf) was removed

Some items remaining to be considered:

  • Update requirements.txt and config.py to some version of numpy >= 2
  • Consider removing UncertainSCI.utils.version
    • The version module appears to only be used to verify numpy version >= 1.17, but I haven't thoroughly investigated this yet.
    • Regardless of where this module is used, I'm of the belief that this type of version checking/validation should be left to the package manager (pip or conda).
    • This also lets us (minorly) simplify the code interface because we don't have the implement two versions of our code for the quirks of our dependencies, though in practice I've only seen this used in our code for choosing a particular implementation of np.choice.

asher-m added 2 commits July 2, 2026 11:28
* use scalar to scalar cast instead of ndim > 0 to scalar cast
  * ndim > 0 to scalar was slated for deprecation in numpy 1.25 and became deprecated in numpy 2.4
* rename np.Inf to np.inf
  * np.Inf served as an alias for np.inf in numpy < 2
  * alias was removed in numpy 2
@asher-m

asher-m commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

This PR resolves issue #123.

akilnarayan
akilnarayan previously approved these changes Jul 2, 2026
@asher-m asher-m merged commit 7c3789b into master Jul 2, 2026
7 of 14 checks passed
@asher-m asher-m deleted the dev/numpy2 branch July 2, 2026 20:22
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