Skip to content

Fix _naxis dimensionality - #18419

Merged
astrofrog merged 4 commits into
astropy:mainfrom
mcara:fix_naxis
Jul 14, 2025
Merged

astrofrog merged 4 commits into
astropy:mainfrom
mcara:fix_naxis

Conversation

@mcara

@mcara mcara commented Jul 11, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes, I believe, the root-cause of issues/PRs reported in #18405 and #18417. It borrows some code from #18417 (mostly testing and ellipses stuff just so that we can test that proposed changes fix the issues reported in #18417) however, the purpose of this draft PR is to illustrate what I meant in the last paragraph in #18417 (comment) and if @astrofrog finds this solution acceptable, I think this fix should go into #18417 (alternatively this could deal with _naxis dimensionality only and #18417 with ellipses after rebasing).

Would these changes also fix #18405, @ayshih ?

Close #18417

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@mcara
mcara requested a review from astrofrog July 11, 2025 04:01
@github-actions

Copy link
Copy Markdown
Contributor

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.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@mcara mcara added skip-changelog-checks Tells bot to skip changlog checks needs-downstream-testing and removed wcs.wcsapi labels Jul 11, 2025
@mcara mcara added this to the v7.1.1 milestone Jul 11, 2025
@pllim pllim added backport-v7.1.x and removed skip-changelog-checks Tells bot to skip changlog checks labels Jul 11, 2025

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems sensible from my point of view

@ayshih

ayshih commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Would these changes also fix #18405, @ayshih ?

Yes, it fixes the primary issue. I'll point out that in #18405 I additionally chose to hide the NAXIS: 0... line from the repr when the shape is undefined.

@mcara

mcara commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

@ayshih I don't think we need to hide NAXIS although I am not against it.

Since @astrofrog did a lot of fixes in his PR + unit tests, would you like to implement my suggested fix in your PR? or will you rebase your PR after this (simplified PR without your ellipses fixes and tests) is merged?

@ayshih

ayshih commented Jul 11, 2025 •

Copy link
Copy Markdown
Contributor

I don't think we need to hide NAXIS although I am not against it.

I guess I'm ambivalent now. It was problematic when the line was always NAXIS: 0 0 regardless of dimensionality.

@mcara
mcara marked this pull request as ready for review July 11, 2025 13:34
@mcara

mcara commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

I guess I'm ambivalent. It was problematic when the line was always NAXIS: 0 0 regardless of dimensionality.

I agree. I do not often work with 3D WCS but I noticed this now and didn't like it. I think it is OK to remove it since the code already prints

Number of WCS axes: 3

and also the number of axes can be inferred from the shape of the PC or CD matrix or CRPIX. That is,

NAXIS: 0 0 0

does not really provide any new information.

Eh, after I wrote this, I think it does make it easier to see 0 0 0 and then think that there is no info on image dimensionality. I wonder if not seeing NAXIS at all would make this more difficult to see.

@mcara

mcara commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

@astrofrog Feel free to port this fix to your PR and then close this or accept/merge this and rebase yours.

@mcara mcara self-assigned this Jul 11, 2025
pllim added a commit that referenced this pull request Jul 14, 2025
…419-on-v7.1.x

Backport PR #18419 on branch v7.1.x (Fix _naxis dimensionality)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants