Fix WCS distortion keyword handling for alternate WCS keys - #19228
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.
|
This comment was marked as resolved.
This comment was marked as resolved.
|
@mcara Changes addressed. All review comments have been implemented and pre-commit checks are passing locally. Looking forward to your final review! |
|
Hi @mcara |
|
I understand the stwcs concern. Happy to help troubleshoot or modify the approach if needed |
This comment was marked as outdated.
This comment was marked as outdated.
|
Our STWCS PR #246 should resolve any issues arising from this change. So we are okay with this proceeding with these changes. |
This comment was marked as resolved.
This comment was marked as resolved.
f4376f7 to
8f7453b
Compare
91f00db to
bb3f511
Compare
|
linkcheck failure is unrelated. devdeps failures also appear unrelated. |
|
Exotic arch failures aren't related, are they, @astrofrog ? |
|
Exotic arch failures are confirmed to be unrelated. Merging. Thanks! |
Description
This pull request addresses issues with WCS distortion lookup tables on secondary WCSes (alternate WCS with key='A', 'B', etc.).
Problem: When a FITS header contains multiple WCS definitions (primary and alternate), the distortion keywords were not respecting WCS key suffixes as specified in the FITS WCS distortion paper. This caused two issues:
Secondary WCS incorrectly loading primary distortion: A secondary WCS without its own distortion keywords (
CPDIS1A,CPDIS2A) would incorrectly load the primary WCS's distortion instead of having none.Crash when secondary WCS has its own distortion: When secondary distortion keywords were properly defined with suffixes, the code would fail to read them and crash with "Unrecognized/unimplemented distortion function: LOOKUP".
Solution: Modified
_read_distortion_kw()to accept akeyparameter and apply the appropriate suffix to all distortion-related keywords (CPDIS{i},CPERR{i},DP{i}.*), ensuring each WCS only reads its own distortion keywords.Changes:
keyparameter to_read_distortion_kw()methodTesting:
Fixes #18914