-
Notifications
You must be signed in to change notification settings - Fork 62
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
numpy 2.0 fixes #743
numpy 2.0 fixes #743
Conversation
numpy 2.0 changes the string format of scalars this format was relied on in gridded_library which this commit updates (by first converting the values to builtin floats prior to converting to strings) numpy 2.0 also removes float_ and complex_ this commit replaces their usage with double and cdouble
Codecov ReportAttention:
📢 Thoughts on this report? Let us know!. |
@braingram - looks good. Will this affect issue #710? |
Thanks! I believe this should (eventually) fix #710 I just noticed 2 uses of |
Go for it |
@BradleySappington Thanks! I pushed b87ae31 updating the usage of EDIT: I was originally seeing errors testing this with the source branch for spacetelescope/poppy#585 The issue was that I had not pushed the git tags from the upstream spacetelescope fork so when I installed my branch it was reporting as an old version of poppy. This caused issues in Lines 1167 to 1171 in ca1fdf6
full traceback (click here)============================= test session starts ============================== platform darwin -- Python 3.10.6, pytest-7.4.2, pluggy-1.3.0Running tests with Webbpsf version 0.1.dev2196+g67177a7.d20230927. Date: 2023-09-27T16:13:10 Platform: macOS-12.6-arm64-arm-64bit Executable: /Users/bgraham/.pyenv/versions/3.10.6/envs/webbpsf/bin/python3.10 Full Python Version: encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8 Package versions: Using Astropy options: remote_data: none. rootdir: /Users/bgraham/projects/src/webbpsf webbpsf/tests/test_opds.py FF [100%] =================================== FAILURES =================================== fov_pix = 50, plot = False, npix = 1024
E AssertionError: Expected A1: +X rotation -> -Y pixels (DMS coords) webbpsf/tests/test_opds.py:481: AssertionError
webbpsf/tests/test_opds.py:534: fov_pix = 50, plot = False, npix = 2048
E AssertionError: Expected A1: +X rotation -> -Y pixels (DMS coords) webbpsf/tests/test_opds.py:481: AssertionError |
Running the tests locally with numpy 2.0 and poppy installed from spacetelescope/poppy#585 I now see no errors or warnings. Fixes: #710 |
The changes in this PR partially address: #737
numpy 2.0 changes the string format of scalars this format was relied on in gridded_library which this PR updates to first convert the values to builtin floats prior to converting to strings.
numpy 2.0 also removes
float_
andcomplex_
. This PR replaces their usage withdouble
andcdouble
. See: numpy/numpy#24376 for the numpy changes and the docs for a description of howfloat_
is an alias ofdouble
andcomplex_
an alias ofcdouble
: https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.float_I attempted to update the CI to use numpy 2.0 and failed. I ran into many issues with versions conflicts that could be boiled down to
contourpy
(used bymatplotlib
) setting an upper pin on numpy 2.0. I was able to get things working locally (although this required building scipy from source as the nightly builds for m1 macs are very out-of-date). With the changes in this PR all tests pass except for 3:These are due to
poly1d
usage inpoppy
addressed here: spacetelescope/poppy#585