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
Use TAP with alma - initial version #1689
Conversation
astroquery/alma/core.py
Outdated
'gal_longitude': 'Galactic longitude', | ||
'gal_latitude': 'Galactic latitude', | ||
'band_list': 'Band', | ||
's_region': 'Spatial resolution', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use some whitespace cleanup
astroquery/alma/core.py
Outdated
try: | ||
import pyvo | ||
except ImportError: | ||
print('Please install pyvo. astropy.vo does not work without it.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as w/previous: shouldn't this just raise?
astroquery/alma/core.py
Outdated
} | ||
|
||
ALMA_BANDS = { | ||
'3': (84*10**9*u.Hz, 116*10**9*u.Hz), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't like GHz?
astroquery/alma/core.py
Outdated
# galactic (Galactic longitude, Galactic latitude str) or | ||
# source_name_resolver (object name) or combination. | ||
# Add them all to the pos list | ||
radius = payload.get('radius', 0.016666666666667*u.deg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe 1*u.arcmin
?
To give you a sense of the API as I've used it, here's a list of a bunch of different queries I have run:
but I'll note that my history of using the band & frequency queries is littered with dozens of failed attempts to get the syntax right. The API we'd like to support does not have to take the same syntax, and in fact it would be helpful if we could check the syntax (and specify it) user-side. So for the basic query API, as long as we continue to support the basic region queries and some variants of the criteria query (on PI, project ID, frequency, band, polarization [tricky, I know], etc), it's OK. I think we'll have to live with syntax-breaking in the uploaded values (e.g., 96 .. 96.5 above) because we don't really know what the old syntax was anyway. |
The majority of those examples should work with the changes in this PR (and probably a few others). Wild cards (project_code='2012.*') however do not work. For users with more intimate knowledge about ALMA, we can create a method to query the TAP service. Users will be given tools to explore the schema of the TAP service ( This approach is not too complicated, keeps the library simple, tries to make the changes less disruptive and appeals to any type of audience, including power users. In summary, I'm proposing:
Sounds acceptable? |
I like this plan. Re: (1) - let's have these as options to Everything else is fine. |
What I meant is that |
yeah, I like the IDE-friendlier specific arguments approach. |
I'm adding to the thread the link to the google docs used for mapping between old parameters and the new ones. Needs to be reviewed and commented on. |
The query samples you've posted with the new API:
Looks OK? I didn't know what |
Yes, looks good, though I definitely want a shortcut approach to those SQL queries! I don't know what You can put some of this stuff in as actual tests and I can give you some inline comments |
4aa6534
to
6982b5f
Compare
Codecov Report
@@ Coverage Diff @@
## master #1689 +/- ##
==========================================
+ Coverage 63.63% 63.91% +0.27%
==========================================
Files 199 200 +1
Lines 15543 15729 +186
==========================================
+ Hits 9891 10053 +162
- Misses 5652 5676 +24
Continue to review full report at Codecov.
|
We've been given a deadline of "this Wednesday", after which the present ALMA archive will be disabled. There are problems. All queries were failing with:
which resulted from a bad mapping.. |
astroquery/alma/core.py
Outdated
for _ in result] | ||
for ii in _OBSCORE_TO_ALMARESULT: | ||
if _OBSCORE_TO_ALMARESULT[ii] not in result.columns: | ||
# duplicate equivalent columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we doing this? For backward compatibility? I don't like it, I'd rather toss one or the other. I guess we can toss the old, stick with the new. We should add, though, a renaming utility using the _OBSCORE_TO_ALMARESULT
mapping to allow users to easily recover the old naming scheme.
row = result[0] | ||
for item in _OBSCORE_TO_ALMARESULT.items(): | ||
if item[0] == 't_min': | ||
assert Time(row[item[0]], format='mjd').strftime('%d-%m-%Y') ==\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my changes cause a failure here, but I suspect that's because the data are out of date - alma_onerow contains data that aren't returned from alma at present.
cache : bool | ||
Cache the query? | ||
The object name. Will be resolved by astropy.coord.SkyCoord | ||
cache : deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to deprecate caching? Does pyvo not support it? The caching functionality is extremely useful, even though it is problematic in several ways (we have no way to test if the cache is out of date, for instance)
astroquery/alma/core.py
Outdated
'is_mosaic': 'Mosaic', | ||
't_exptime': 'Integration', | ||
'obs_release_date': 'Release date', | ||
'frequency': 'Frequency support', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this & coi_name, but that triggered some remote test failures. My changes may therefore be incorrect and need to be reverted - feel free to do so, but let's make sure the docs examples work.
645cca3
to
6518c9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the extra changes leaking into the PR issues has been resolved I approve this PR. Looks good.
3bc127c
to
a1e5fcc
Compare
Thanks @andamian! |
No description provided.