Skip to content

Initial ASDF extension and tests#2211

Open
nden wants to merge 8 commits intoastropy:mainfrom
nden:asdf-init
Open

Initial ASDF extension and tests#2211
nden wants to merge 8 commits intoastropy:mainfrom
nden:asdf-init

Conversation

@nden
Copy link
Copy Markdown
Contributor

@nden nden commented Mar 4, 2026

This PR is a contribution to astropy/astropy-project#527 . It implements the initial setup for serializing photutils PSF and aperture objects to ASDF. The proposal mentioned the implementation will be in asdf-astropy. However, after discussion with the ASDF developers we decided to include the implementation in photutils in order to keep the library code in sync with the serialization more easily. This PR adds

  • ASDF extension
  • Schemas for one PSF model and one aperture
  • Converters for the obkects
  • Sets up testing of schemas and adds tests for the converters

I am not able to request reviewers so tagging here @larrybradley @perrygreenfield @braingram

@larrybradley
Copy link
Copy Markdown
Member

pre-commit.ci autofix

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 5, 2026

pre-commit.ci autofix

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 5, 2026

pre-commit.ci autofix

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 6, 2026

Bumping the min version of astropy to v 7.2 fixed the oldestdeps test. Is this an acceptable change?

@larrybradley
Copy link
Copy Markdown
Member

@nden Is astropy 7.2 (released Nov 2025) the only version that works? Requiring only the latest release of astropy does seem to be a bit restrictive. That would also put constraints on all photutils dependencies, like jwst, romancal, drizzlepac/hap, etc.

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 7, 2026

The failing tests were using astropy 6.1.4. It appears there was a follow up bug fix release, 6.1.7, which works.

Copy link
Copy Markdown

@braingram braingram left a comment

Choose a reason for hiding this comment

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

I do not have enough experience with photutils to test if real instances of these classes roundtrip so I only looked at this from an asdf extension perspective. I left a few comments, questions and suggestions.

Overall looks like it's on the right track. Aside from the one suggested schema change the rest of the comments are mostly questions or test changes.

filterwarnings = [
'error', # turn warnings into exceptions
]
asdf_schema_root = 'photutils/resources/schemas'

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@nden nden Mar 13, 2026

Choose a reason for hiding this comment

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

I rebased this PR on main. Now the number of tests is

  • on main: 3038 passed, 30 skipped
  • this pr: 3040 passed, 30 skipped

This is the expected change in number of tests counting the converter tests.

I was not aware of the issue of testing schemas with --pyargs. Thanks for the pointers. Commit 96f4d4b adds a dedicated test for the schemas.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks! This looks great.

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 13, 2026

@braingram Thanks for the review. I think I addressed the comments except one additional question.

Copy link
Copy Markdown

@braingram braingram left a comment

Choose a reason for hiding this comment

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

Thanks for making these updates!

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 22, 2026

@larrybradley Unless you have other comments I think this is ready to merge.

Copy link
Copy Markdown
Member

@larrybradley larrybradley left a comment

Choose a reason for hiding this comment

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

Thanks, @nden (and @braingram for the review). Is there a longer-term plan to add more photutils objects? I'm planning to release 3.0 soon, and was wondering if this PR should be included.

@nden
Copy link
Copy Markdown
Contributor Author

nden commented Mar 25, 2026

@larrybradley I will submit two more PRs very soon, implementing serialization for the rest of the PSFs and the apertures.

@larrybradley larrybradley added this to the 3.1.0 milestone Mar 25, 2026
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