-
Notifications
You must be signed in to change notification settings - Fork 19
Compatibility with numpy 2 #248
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
Conversation
This adds a shim similar to scipy that sets copy=False in numpy < 2 and copy=None otherwise.
When the input variable ``val`` may be of type np.int32. This forces an implicit casting of ``fval``, and when it is equal to or exceed 2**31, an OverflowError is raised. This explicit casting prevents this error.
With numpy<2, bitwise_and does not operate on uint64 dtype objects. Given that the range of fval is within the range of uint32, casting to uint32 suffices. If the input value has more bits, they will be not used anyway regardless of the casting as long as fval is limited to 2**31.
|
@esheldon comments here or shall we merge? |
|
Arun are you still making additions? |
|
Nope, I don't have any more to add unless there are requests. Could you also please cut a release after merging this? |
|
Sure, can you make a comment in CHANGES.txt with a short explanation? |
|
I shall, but I also notice that changes from #246 have not made it into a release yet. I will let you comment on that. With that included, would it bump up the minor version, right? (this PR alone should bump the patch version I think) |
|
I'll add notes for that. I'll do the version bump when I make my changes. |
|
Thanks Arun and Matt |
|
v2.4.0 is released |
|
Thank you, Erin! |
This PR makes
ngmixcompatible withnumpy>=2andnumpy<2.The recommended method is to replace
np.array(..., copy=False)withnp.asarraylink. However, given the necessity ofndminwhich is not available inasarray, I took the scipy approach here.