Repository navigation
Add a test for the reporting of the shape of a 1D WCS - #18405
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.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
|
@ayshih - is this still needed? If so, could you rebase? (at least would be good to keep the test?) |
|
Personally, I think it is not needed as it helps my brain to see |
Agreed, I've adjusted this PR so it's now only adding a test.
I think the NAXIS line is fine now that #18419 fixed the problematic aspect. That is, for a 1D WCS, the repr now reports |
|
Thanks, all! |
…405-on-v7.1.x Backport PR #18405 on branch v7.1.x (Add a test for the reporting of the shape of a 1D WCS)
After the changes in #18419, this PR has been reduced to simply adding a test.
Original PR text:
Description
This PR fixes the reporting of shape of a 1D WCS. The shape of a 1D WCS when read from a header is set to a 2D shape with the second pixel dimension (NAXIS2) being zero. This appears to be vestigial: this approach was originally to support a
_naxis2property (#5411 from 2016), but that property has long since been removed (#9465 from 2019).Before this PR:
After this PR:
This PR also makes a change to the repr of the WCS instance. When the shape is undefined in the header or is cleared, the private attribute (
WCS._naxis) gets set to the sentinel value of[0, 0](irrespective of the number of pixel dimensions). Public API likeWCS.pixel_shapecheck for the sentinel value, but the repr directly accessesself._naxis, so the puzzling lineNAXIS : 0 0appears in the repr. I think changing the sentinel-value approach could break code in the wild, so this PR takes the simple approach of checking for the sentinel value before printing out theNAXIS: ...line.