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

ALMA: What kind of region is s_region? #2687

Closed
keflavich opened this issue Mar 16, 2023 · 7 comments
Closed

ALMA: What kind of region is s_region? #2687

keflavich opened this issue Mar 16, 2023 · 7 comments
Labels

Comments

@keflavich
Copy link
Contributor

@andamian What kind of region is the s_region returned by ALMA?

from astroquery.alma import Alma
from astropy import units as u, constants
from astropy.coordinates import SkyCoord
import regions

rslt = Alma.query_region(SkyCoord(25*u.deg, 0*u.deg, frame='galactic'), radius=1*u.deg)

rslt['s_region'][0]
# 'Polygon ICRS 279.506917 -7.744253 279.505574 -7.744000 279.504420 -7.743274 279.503525 -7.741969 279.503269 -7.740639 279.503525 -7.739308 279.504420 -7.738004 279.505574 -7.737278 279.506917 -7.737024 279.508470 -7.737368 279.509576 -7.738165 279.510308 -7.739308 279.510564 -7.740639 279.510308 -7.741969 279.509414 -7.743274 279.508260 -7.744000'

This doesn't look like any of the standard serialization formats handled by regions (https://astropy-regions.readthedocs.io/en/stable/region_io.html).

Is it a standard format that we could (should) handle in regions? Or can we provide some helper here in astroquery to parse it as a region? e.g.

def parse_region(reg):
    spl =reg.split()
    if spl[0] == 'Polygon':
        csys = spl[1]
        points = SkyCoord([(float(spl[ii]), float(spl[ii+1]))*u.deg
                  for ii in range(2, len(spl), 2)], frame=csys.lower())
        return regions.PolygonSkyRegion(points)
@keflavich keflavich added the alma label Mar 16, 2023
@andamian
Copy link

I'm going to cc @at88mph as he's been playing with this recently.

@at88mph
Copy link
Contributor

at88mph commented Mar 20, 2023

ALMA's ObsCore service outputs the s_region column in an STC-S string in the ICRS frame, as per the specification at https://www.ivoa.net/documents/ObsCore/20170509/REC-ObsCore-v1.1-20170509.pdf (4.12). You're right, it does not appear to conform to the three main formats supported by the Regions class, but can be easily parsed into a PolygonSkyRegion instance as described.

@bsipocz
Copy link
Member

bsipocz commented Jul 25, 2023

I believe this can be close here as it's already upstreamed to regions?

@andamian
Copy link

Do you have a reference if it's upstreamed? I was tasked to trying to find a solution to it. thanks

@bsipocz
Copy link
Member

bsipocz commented Jul 26, 2023

@andamian - Would astropy/regions#21 be sufficient?

@andamian
Copy link

Oh. I see, it comes back to us (CADC) since there are no updates on that issue since 2018. But yes, I think it belongs upstream. thanks

@bsipocz
Copy link
Member

bsipocz commented Jul 26, 2023

Yes, I have cross dependent issues that bites back to me often 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants