Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DS9 IO of Text regions #548

Merged
merged 4 commits into from Apr 9, 2024

Conversation

larrybradley
Copy link
Member

This PR fixes an issue where writing Text regions (e.g., TextPixelRegion) to DS9 would drop the text field. It also fixes an issue in the DS9 file reader/parser to have only one copy of the text field in the object instance (i.e., not duplicated in meta).

@larrybradley larrybradley added this to the 0.9 milestone Apr 9, 2024
Copy link
Contributor

@keflavich keflavich left a comment

Choose a reason for hiding this comment

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

I'm not sure I follow why text is a special parameter - is it not just normal metadata? (I haven't looked closely at the unchanged source in a while, so maybe it's obvious)

@larrybradley
Copy link
Member Author

larrybradley commented Apr 9, 2024

For text regions, DS9 stores the text value the same way as additional metadata. It's not included in the shape definition (only the coords are). So for Text regions, we need to explicitly add "text" to the metadata when writing, and then remove it when reading (it gets stored in the class attribute) -- that prevents two copies of the same thing and them going out of sync.

@larrybradley larrybradley merged commit 44d81b4 into astropy:main Apr 9, 2024
20 checks passed
@larrybradley larrybradley deleted the fix-text-serialization branch April 9, 2024 16:48
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.

None yet

2 participants