Skip to content

Preserve nested masks with data-mask serialization - #20094

Open
nomad3 wants to merge 3 commits into
astropy:mainfrom
nomad3:fix-18704-nested-data-mask
Open

nomad3 wants to merge 3 commits into
astropy:mainfrom
nomad3:fix-18704-nested-data-mask

Conversation

@nomad3

@nomad3 nomad3 commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This pull request makes Table.write(..., serialize_method="data_mask") propagate the selected mask serialization into compatible masked components nested inside mixin columns.

For a masked SkyCoord, this writes separate sc.ra.mask and sc.dec.mask columns, preserving both independently masked components and their underlying values. Selector matching remains at the original table-column level for string, column-name, and column-class forms. Nested serializers that do not support masked-data methods, such as a Time stored in SkyCoord.obstime, retain their existing serialization.

The regression uses disjoint coordinate masks and distinct underlying data, and also checks default behavior, a nonmatching selector, context restoration, and nested Time.

Fixes #18704

Validation

  • Targeted nested-mask regression: 7 passed
  • pytest -q astropy/table/tests astropy/io/ascii/tests/test_ecsv.py astropy/utils/masked/tests/test_table.py — 2,930 passed, 183 skipped, 14 xfailed
  • pytest -q astropy/io/fits/tests/test_connect.py astropy/io/misc/tests/test_hdf5.py — 175 passed, 123 skipped
  • Full pre-commit suite on the four changed files, including pinned Ruff check/format, codespell, repository review, and Sphinx lint
  • git range-diff confirms that rebasing onto current main did not change either patch

AI assistance

I used OpenAI Codex and Anthropic Claude Code as development and review assistants, with human direction and review throughout. I have reviewed and understand the submitted implementation and tests, take responsibility for all submitted content and licensing compliance, and will engage directly with reviewer questions and feedback.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button.

@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.

@nomad3
nomad3 force-pushed the fix-18704-nested-data-mask branch from d048f24 to c21ca6c Compare July 28, 2026 21:27
@nomad3
nomad3 marked this pull request as ready for review July 28, 2026 21:28
@neutrinoceros
neutrinoceros removed their request for review October 28, 2026 11:24

This branch has not been deployed

No deployments
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.

Writing masked columns with serialize_method="data_mask" has no effect

2 participants