-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
Refactor astroquery.heasarc to use VO protocols #2997
base: main
Are you sure you want to change the base?
Conversation
Hello @zoghbi-a! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-05-15 14:58:22 UTC |
43e9fe4
to
7f74228
Compare
What is the motivation for this? Are there any datasets that are only accessible using the webform, but not the VO backends? (If the only motivation is to keep what has been here, then it's not necessary, removing everything as part of the refactor is totally fine. Ideally, the old user codes should keep working, but with such a large backend restructure we also have precedence for breaking those) Doing a proper review may take me until I'm back from the interop. |
All the tables should available through the new API, so it is kept in case some people are using it. If it is ok to remove the old class, I don't see a stopper. |
A rename doesn't really solve this scenario, as the continued support would have only worked if the name was kept the same, maybe with a deprecation warning. So, before diving into a review, I would suggest cleaning up the old class. Maybe try to keep as much of the test examples/docs examples working as possible, or maybe working with a deprecation warning (e.g. in case some of the keywords need to be dropped, or renamed). |
The new class implements most of the useful methods of the old class with a deprecation warning. I will then delete the old class and keep the methods and warnings in the new class. |
a746966
to
354384f
Compare
354384f
to
baf95ed
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.
I only leave a WIP review for now, that focuses only on the API, and will try to come back and look into the code itself later, hopefully later this week or next week. I was thinking it's useful to leave what I have for now, than hold it back until I have the time to do the full review.
@@ -9,6 +9,9 @@ | |||
The initial version of this was coded in a sprint at the | |||
"Python in astronomy" workshop in April 2015 by Jean-Christophe Leyder, | |||
Abigail Stevens, Antonio Martin-Carrillo and Christoph Deil. | |||
|
|||
Updates to use the XAMIN service was added by Abdu Zoghbi |
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.
All of this and the above author 3 lines can be cleaned-up, too. Git carries the history, and we'll also work on a team website that will list whoever is actively maintain the module.
heasarc | ||
^^^^^^^ | ||
|
||
- Refactor heasarc to use the VO backend. The old Heasarc class is now HeasarcBrowser [#2997] |
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.
Drop the second sentence as we don't keep the old class
return Table.read(*args, **kwargs) | ||
else: | ||
return Table.read(*args, **kwargs, unit_parse_strict='silent') | ||
|
||
|
||
@async_to_sync | ||
class HeasarcClass(BaseQuery): |
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.
Do inherit from the VO baseclass, too, using the order in the other modules (so e.g. the session is properly get passed back to pyvo, and a couple of other small things)
return self._tap | ||
|
||
@property | ||
def _meta(self): |
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 a great idea, and great that the server returns the info in the table and not in the metadata of the table, as e.g astropy has serious toubles with parsing that non-column metadata
defaults = meta['par'] | ||
return defaults | ||
|
||
def get_default_radius(self, table_name): |
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.
make this private, too, similar to _get_default_cols
|
||
return self.query_async(request_payload, cache=cache) | ||
def get_links(self, query_result=None, tablename=None): |
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.
are these datalinks? Then call it get_datalinks
instead (like in gaia), though here were are inconsistent yet again as alma has datalink
instead. But not many modules have datalinks yet, so we can sort out the API now and use that for the future (and then clean up the inconsistent, but existing modules)
|
||
return dl_result | ||
|
||
def enable_cloud(self, provider='aws', profile=None): |
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.
hopefully everthing cloud related will make its way up to pyvo, eventually, but until then it all can stay of course.
|
||
fits_content = fits.open(BytesIO(content)) | ||
def download_data(self, links, host='heasarc', location='.'): |
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 how much of this can be put in the baseclass
The result from get_links | ||
host : str | ||
The data host. The options are: heasarc (defaul), sciserver, aws. | ||
If host == 'sciserver', data is copied from the local mounted |
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 very specific corner case only for sciserver. Will it work for smce, too?
|
||
def get_package_data(): | ||
paths = [ | ||
os.path.join("data", "*.dat"), |
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 don't see the datafiles being deleted. Should they be?
This a major refactor of the
heasarc
module to use the VO interface to the archive. The main motivation is:The main changes inlcude:
HeasarcClass
->HeasarcBrowseClass
. The initialized instance is also renameHeasarc
->HeasarcBrowse
. The same for the test files.HeasarcClass
class uses an interface similar to those used in other modules e.g. ipac.irsa.