-
Notifications
You must be signed in to change notification settings - Fork 18
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
HLA-1312: Numpy 2.0 scalar promotion issues in STWCS #206
HLA-1312: Numpy 2.0 scalar promotion issues in STWCS #206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual promotion looks fine.
I wonder why are |
I wonder whether it would be better to modify stwcs/stwcs/distortion/mutil.py Lines 200 to 213 in 5a9212e
to simply store Python float instead of whatever type is in the table.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be better to just convert tab values to floats right away (currently they can be both np.float32 and Python float (0.0) which is a little inconsistent) then to promote to float64 at the end stage but it is not wrong.
Thanks for reviewing this. I would prefer to do it the right way. I couldn't find where they were instantiated, so now that you've pointed it out, I will set the type at the beginning of the process. |
Co-authored-by: Mihai Cara <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
Resolves HLA-1312
Closes #199
This PR addresses issues related to scalar promotion in numpy 2.0. The main issues are related to the IDCTAB refpix values being downgraded. More precisely, they are no longer automatically being upgraded from a float32 to a float64.
The important value that is now manually upgraded is the 'PSCALE'. Without this change, the 'PSCALE' is truncated (e.g. for ACS, WFC3, and WFPC2 IDCTABs) with a float32.
Several other values in the IDCTAB ('XREF', 'YREF', and 'THETA') are no longer automatically being upgraded, but these do not affect the results as, while they are technically floats, the values are integers.
Checklist for maintainers
CHANGELOG.rst
within the relevant release section