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

Strip some characters from STC-S string definitions #5

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

gbrammer
Copy link
Owner

Parse a string like

>>> import sregion
>>> sr = sregion.SRegion("""Union ICRS ( Polygon 239.807341 -18.296691 239.803564 -18.300277 239.799786 -18.296691 239.803563
-18.293105 Polygon 239.797826 -18.295944 239.794049 -18.299530 239.790272 -18.295944 239.794049
-18.292358)""")
>>> print(sr.xy)
[array([[239.807341, -18.296691],
        [239.803564, -18.300277],
        [239.799786, -18.296691],
        [239.803563, -18.293105]]),
 array([[239.797826, -18.295944],
        [239.794049, -18.29953 ],
        [239.790272, -18.295944],
        [239.794049, -18.292358]])]

The Union ICRS prefix is simply stripped from the string and the SRegion object is the combination of the two polygons. Nothing is done for sophisticated "region math" with regions, intersections, differences, etc.

@gbrammer
Copy link
Owner Author

The IVOA definition of the STC-S standard can be found at https://www.ivoa.net/documents/STC-S/20130917/WD-STC-S-1.0-20130917.html. SRegion makes no attempt at being fully compliant with this standard!

@gbrammer gbrammer merged commit 5925904 into main Aug 17, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant