Repository navigation
BUG: avoid deprecated shape mutating APIs (coordinates) - #19127
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
17743bd to
4d7ea1b
Compare
|
docs failures are unrelated #19134 |
3298dc3 to
509d8fd
Compare
509d8fd to
69e5eb1
Compare
|
I still see other coordinates stuff emitting warnings. Will that be a separate PR? |
|
Looks to me that these a really upstream issues, so yeah, definitely a separate PR. |
|
for reference: brandon-rhodes/python-jplephem#63 |
mhvk
left a comment
There was a problem hiding this comment.
The first change is good, but I think for anything inheriting from ShapedLikNDArray, we should let the deprecations percolate up (as we implicitly do for Quantity).
| oldshape = self.shape | ||
| for component in self.components: | ||
| val = getattr(self, component) | ||
| if val.size > 1: |
There was a problem hiding this comment.
Shouldn't we just let the deprecations appear? I think eventually we want to just follow numpy and no longer allow direct setting of shape. I.e., here adjust the tests to expect deprecation warnings for numpy >=2.5.
There was a problem hiding this comment.
I agree. I was actually thinking we could do this as a second phase, after CI is back to green, so other devs don't get accustomed to ignoring failures in allowed-failures, as it's not immediately obvious to me exactly how to do this properly, and we probably want to get it right the first time. WDYT ?
mhvk
left a comment
There was a problem hiding this comment.
Approving now after we decided to separate out letting shape setting deprecations perculate up.
…nates) (#19169) Co-authored-by: Marten van Kerkwijk <[email protected]>
Replace .shape = assignments with .resize(new_shape, refcheck=False) to maintain compatibility with NumPy 2.5+ while preserving all existing functionality. Changes: - coordinates/solar_system.py: Fix body_posvel_bary shape assignment - coordinates/representation/base.py: Fix component and differential shape assignments - time/core.py: Fix val shape assignments with error recovery - io/ascii/ecsv.py: Fix column shape assignments (2 occurrences) - io/fits/util.py: Fix array reshape in NumPy < 2.5 branch - io/fits/fitsrec.py: Fix field shape assignment - uncertainty/core.py: Fix structured array shape assignment - Test files: Update compressed FITS and image tests All fixes use refcheck=False parameter for Astropy's array views and follow patterns from merged PRs astropy#19127-astropy#19152.
Description
ref #19126