-
-
Notifications
You must be signed in to change notification settings - Fork 423
Access to NOIRLab Astro Data Archive #3359
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
base: main
Are you sure you want to change the base?
Conversation
TO DO items identified (i.e. before even starting the review process):
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3359 +/- ##
==========================================
+ Coverage 70.07% 70.63% +0.56%
==========================================
Files 232 234 +2
Lines 19893 20092 +199
==========================================
+ Hits 13940 14192 +252
+ Misses 5953 5900 -53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Note to self: |
You also need |
@keflavich @bsipocz this is ready for first-pass review. I'm having some trouble with the doc build:
I've tried to set up the title levels similar to other packages, such as sdss. I'm also looking for advice on whether further application of |
PS, the |
Thanks. I need to get back to the ESO review first, but put this on the list now, too. |
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.
We did a partial review with some comments, I'm coming back to finish this later this week so no need to address any of these yet.
rows = [[row[n] for n in names] for row in response_json[1:]] | ||
return astropy.table.Table(names=names, rows=rows) | ||
|
||
def service_metadata(self, hdu=False, cache=True): |
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 this an end user method or should rather be something private?
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'm not really sure how or whether this would be used by end users. Let me think about that a bit more.
astroquery/noirlab/core.py
Outdated
def query_region_async(self, coordinate, radius=0.1, hdu=False, cache=True): | ||
"""Query for NOIRLab observations by region of the sky. | ||
|
||
Given a sky coordinate and radius, returns a `~astropy.table.Table` | ||
of NOIRLab observations. | ||
|
||
Parameters | ||
---------- | ||
coordinate : :class:`str` or `~astropy.coordinates` object | ||
The target region which to search. It may be specified as a | ||
string or as the appropriate `~astropy.coordinates` object. | ||
radius : :class:`str` or `~astropy.units.Quantity` object, optional | ||
Default 0.1 degrees. | ||
The string must be parsable by `~astropy.coordinates.Angle`. The | ||
appropriate `~astropy.units.Quantity` object from | ||
`~astropy.units` may also be used. | ||
hdu : :class:`bool`, optional | ||
If ``True`` return the URL for HDU-based queries. | ||
cache : :class:`bool`, optional | ||
If ``True`` cache the result locally. | ||
|
||
Returns | ||
------- | ||
:class:`~requests.Response` | ||
Response object. | ||
""" | ||
self._validate_version() | ||
ra, dec = coordinate.to_string('decimal').split() | ||
url = f'{self._sia_url(hdu=hdu)}?POS={ra},{dec}&SIZE={radius}&VERB=3&format=json' | ||
response = self._request('GET', url, timeout=self.TIMEOUT, cache=cache) | ||
# response.raise_for_status() | ||
return response |
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.
We may want to have async as a kwarg instead and not have two separate methods. See how we do this in some of the other modules e.g. in cadc
or ipac.irsa
(or the esa modules).
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 far as I can tell cadc
still has the old @async_to_sync
setup. I took a look at ipac.irsa
, and there it is apparent that the meaning of async_job
is to submit asynchronous queries to a job system of some kind. That doesn't apply to the NOIRLab API.
Based on my experience with sdss
, historically "async" meant "return the response object from self._request()
, while "sync" meant "based on the response object, download the files referenced in it". This is definitely more applicable to NOIRLab.
Can you elaborate further on the different meanings of "async"?
# response.raise_for_status() | ||
return response | ||
|
||
def core_fields(self, hdu=False, cache=True): |
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.
How would you feel about having just one method for these three with a kwarg for 'core', 'aux', and 'categoricals'? e.g. list_fields(...)
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.
Good suggestion, I will work on that.
@bsipocz, thank you, the suggestions all look good so far, but given my schedule it will be easier to address them all when you're done. |
Yes, totally understandable. I really just submitted this half baked review as that is how far we got during the review tutorial during the summer school I was teaching at. I'll get back to the rest later and will write up an actually usable summary, as there are a couple of things that will need to be fixed while the rest is really just some potential follow-up topics. And again, thanks for working on this, getting a working noirlab module will be superb! |
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 have some more comments to finish up my review.
The overarching theme is to make the API a little bit more consistent with the other modules. And maybe consider using pyvo, but that one is optional for this PR.
And in the meantime it looks like the upstream API has changed, so that may mean some tweaks will be necessary (though the tests are primarily failing with the API number comparison).
Also, the docs build runs into some sphinx errors due to API heading inconsistencies, I'm happy to fix up those before merging.
f'{self.api_version} from the API.') | ||
raise RemoteServiceError(msg) | ||
|
||
def _sia_url(self, hdu=False): |
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.
We're not super consistent yet, but the other modules have either a simple sia_url
attribute or a property. In the other modules there is a sia_url
property instead of a private method
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 can promote that to a public method, but there are genuinely two different SIA URLs in the NOIRLab API, one for queries on whole files, the other for HDUs within files. For example, DECam files contain many HDUs, each of which can be considered a separate image.
self._validate_version() | ||
ra, dec = coordinate.to_string('decimal').split() | ||
url = f'{self._sia_url(hdu=hdu)}?POS={ra},{dec}&SIZE={radius}&VERB=3&format=json' | ||
response = self._request('GET', url, timeout=self.TIMEOUT, cache=cache) | ||
# response.raise_for_status() | ||
return response |
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 wonder if you would consider using pyvo here rather than manually writing the SIA query? It would make things a bit more consistent and easier to maintain even without noirlab interaction
(even if the answer is yes, that can come in a follow-up)
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.
This is definitely a good idea, but I would need to get more familiar with pyvo, so I am in favor postponing that to a separate PR.
return response | ||
|
||
def core_fields(self, hdu=False, cache=True): | ||
"""List the available CORE fields for file or HDU searches. |
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.
If there are any outside docs page that describes what CORE fields mean, it would be useful to mentioned it here.
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 think so, I will take a look.
astroquery/noirlab/core.py
Outdated
response.raise_for_status() | ||
return self._response_to_table(response.json()) | ||
|
||
def retrieve(self, fileid): |
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.
rather than retrieve
, it would be more consistent to call this get_image
or something similar that we already have elsewhere in astroquery.
(we have a couple of variation on it though, and here I think we don't distinguish between file content type (if it's an image vs spectrum -- though technically everything is an image? -- so you could call it get_file
)
I summon @keflavich to see if he has some better insight.
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 have renamed this to get_file in the latest commit, but if another name is preferred, it is easy to change.
Thank you, I was planning to pick this up next week anyway, so this is good timing. |
Commit 64b84bf addresses some of the review comments. Others will be addressed soon. There is an issue that needs to be investigated on the NOIRLab side though. Since I last tested in July, when metadata fields are requested in a query, e.g. |
Also, I have no clue why the |
That error rings a bell, and will be related to the generated API docs. I would recommend ignoring it for now and I'll have a closer look once this is ready to go in. |
This PR closes #1701.
The initial commit simply restores the NOIRLab files to the state and content they were when #1701 was last worked on. Further work and testing will be needed to meet astroquery standards.