Fix/numpy2 compat - #17
Merged
Merged
Conversation
EdoLu
commented
Jul 15, 2026
Collaborator
@RS-ins thanks for the work! |
RS-ins
commented
Jul 15, 2026
ContributorAuthor
Dear professor, I would like to notify you that I have sent a follow up PR to fix the matplotlib version dependency that came up with the PR #17. |
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 freeto 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: GEMAct crashes on NumPy ≥ 2.0.
Two removals bite: np.infty (gone in 2.0) and calling nonzero on 0-d arrays (now an error), the latter hitting scalar pmf/ppf calls on the zero-truncated/zero-modified distributions and Exponential.ppf. Currently masked by the numpy<2.0.0 pin, which forces a downgrade in any modern environment.
Changes: 5× np.infty → np.inf; 6× wrap the np.where condition in np.atleast_1d (as NumPy's own error message recommends), leaving the existing x.shape == () branches untouched; relax the pin.
Verification: full test suite passes on NumPy 2.5.1 (31 passed).
Before the second fix, 6 tests failed; before the first, hard crash.
Also verified on 1.26.4 — results bit-identical, so no behavior change for existing users.