Skip to content

Updates for photutils 3+ deprecations#10408

Merged
melanieclarke merged 1 commit into
spacetelescope:mainfrom
larrybradley:photutils3-compat
Apr 9, 2026
Merged

Updates for photutils 3+ deprecations#10408
melanieclarke merged 1 commit into
spacetelescope:mainfrom
larrybradley:photutils3-compat

Conversation

@larrybradley
Copy link
Copy Markdown
Member

@larrybradley larrybradley commented Apr 1, 2026

Resolves JP-nnnn

This PR makes updates for renamed/deprecated columns and arguments in photutils 3+. This will prevent new deprecation warnings in devdeps tests.

Tasks

  • If you have a specific reviewer in mind, tag them.
  • add a build milestone, i.e. Build 12.0 (use the latest build if not sure)
  • Does this PR change user-facing code / API? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see changelog readme for instructions)
      • if your change breaks step-level or public API (as defined in the docs), also add a changes/<PR#>.breaking.rst news fragment
    • update or add relevant tests
    • update relevant docstrings and / or docs/ page
    • start a regression test and include a link to the running job (click here for instructions)
      • Do truth files need to be updated ("okified")?
        • after the reviewer has approved these changes, run okify_regtests to update the truth files
  • if a JIRA ticket exists, make sure it is resolved properly

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.76%. Comparing base (d10b662) to head (1cdece2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
jwst/tweakreg/tweakreg_catalog.py 73.68% 5 Missing ⚠️
jwst/extract_1d/ifu.py 40.00% 3 Missing ⚠️
jwst/source_catalog/source_catalog.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10408      +/-   ##
==========================================
- Coverage   85.77%   85.76%   -0.01%     
==========================================
  Files         372      372              
  Lines       40032    40047      +15     
==========================================
+ Hits        34336    34348      +12     
- Misses       5696     5699       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread jwst/tweakreg/tweakreg_step.py
@mcara
Copy link
Copy Markdown
Member

mcara commented Apr 2, 2026

What is kind of concerning or at least needs discussion is that catalog columns keep changing over time. So a PR like this is needed to modify tweakreg step to recognize the new column names. Instead, shouldn't the pipeline be stable and create catalogs with the same column names? That is, shouldn't the change be made in the source finding part of the step so that catalogs created by the pipeline are not changed?

Also, IMO, it would have been useful if the version of the pipeline and photutils (and maybe astropy) be written to the catalog in some meta if possible. It seems to me this is more important than the installed version of the photutils package.

What will happen (how will this work) if I have the old version of the pipeline and photutils installed and a collaborator uses the new version and sends me the catalog files? If our catalog formats keep changing, there has to be a way for end-users to figure out how they were created and what software is needed to read them.

@larrybradley
Copy link
Copy Markdown
Member Author

The jwst tweakreg and catalog output column names are unchanged. The photutils column names are changed, but they are gracefully deprecated. Both the old and new photutils column names continue to work, but the old names give a DeprecationWarning. To ease the transition, there will be a long deprecation period (at least until 4.0 in 2027) with plenty of time to adjust.

@melanieclarke melanieclarke added this to the Build 13.0 milestone Apr 7, 2026
@melanieclarke
Copy link
Copy Markdown
Collaborator

melanieclarke commented Apr 7, 2026

Regtests with current dependencies:
https://github.com/spacetelescope/RegressionTests/actions/runs/24084390238
All passing.

Regtests with devdeps:
https://github.com/spacetelescope/RegressionTests/actions/runs/24084426765

There are some errors related to centroid columns, for IFU processing, looks like from this line at a minimum:

jwst/extract_1d/ifu.py:662: in extract_ifu
    x_center, y_center = sources[indx]["xcentroid"], sources[indx]["ycentroid"]

@larrybradley - can you please take a look at photutils usage in the extract_1d step?

@larrybradley
Copy link
Copy Markdown
Member Author

larrybradley commented Apr 9, 2026

Thanks, @melanieclarke. Indeed, I missed those in ifu.py, but they are fixed now.

The devdeps regtests don't show any remaining failures due to photutils 3+ renamed deprecations. The orientation column differences will need to be okified -- the angles are now wrapped [0, 360).

Copy link
Copy Markdown
Collaborator

@melanieclarke melanieclarke left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for the future-proofing.

@melanieclarke melanieclarke merged commit 297b30f into spacetelescope:main Apr 9, 2026
29 of 30 checks passed
@larrybradley larrybradley deleted the photutils3-compat branch April 13, 2026 18:24
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.

3 participants