-
-
Notifications
You must be signed in to change notification settings - Fork 400
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-10-21 02:03:21 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. |
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.
@bsipocz, is there a timeline for completing the review? |
00af79e
to
b854991
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2997 +/- ##
==========================================
- Coverage 67.49% 67.20% -0.29%
==========================================
Files 233 233
Lines 18413 18528 +115
==========================================
+ Hits 12428 12452 +24
- Misses 5985 6076 +91 ☔ View full report in Codecov by Sentry. |
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 did an airport review, thus couldn't run the remote tests and their coverage.
Neither was building the documentation, but what I have noticed that it is full of both code and text typos, so please have a careful look at it.
The module itself looks reasonably good, my primary comments are the same I already left in the summer, namely it would be great if methods and arg names could be more similar to those already existing in some of the modules (e.g. avoid using table
as a kwarg as it leads to either confusion or code mistakes.
astroquery/heasarc/core.py
Outdated
|
||
@async_to_sync |
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 this is practically a new module, no need to do this. (I'll clean these up in the upcoming astroquery work, but it's even better if it's not added).
We have started to talk about to ditch the duplication of methods and implement actual async methods (#2598)
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.
removed!
from ..exceptions import InvalidQueryError, NoResultsWarning | ||
from . import conf | ||
|
||
__all__ = ['Heasarc', 'HeasarcClass'] |
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.
Please don't remove this, we don't want to expose all of the above imports, etc in the public namespace
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.
Thanks for spotting this. I think it was removed by mistake.
astroquery/heasarc/core.py
Outdated
Example Usage: | ||
... |
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.
Either add an example here or preferably remove these
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.
removed!
astroquery/heasarc/core.py
Outdated
|
||
@async_to_sync | ||
class HeasarcClass(BaseVOQuery, BaseQuery): | ||
"""Class for accessing HEASARC data using XAMIN. |
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.
what is XAMIN?
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.
The VO backend. Changed to clarify
VO_URL = conf.VO_URL | ||
TAR_URL = conf.TAR_URL | ||
S3_BUCKET = conf.S3_BUCKET |
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 we need these here, or the properties could pick them up? (like we do in alma
or the other modules that use pyvo based tap?)
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 you suggesting that these should not be configurable but rather as fixed variables?
docs/heasarc/heasarc.rst
Outdated
NGC_3783 60902005 174.7571 -37.7385 | ||
|
||
To query a region around some position, specifying the search radius, | ||
we use `~astropy.units`: |
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.
don't refer to the module, but the classes.
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.
changed.
|
||
If no radius value is given, a default that is appropriate | ||
for each table is used. You can see the value of the default | ||
radius values by calling `~~astroquery.heasarc.HeasarcClass._get_default_radius`, |
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 private function, don't refer to it in the narrative documentation.
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 this method can be useful to the user, and that is why it is documented. It was initially public, and changed it to private after the first set of comments. I leaning towards making it public again and then referenced it here.
docs/heasarc/heasarc.rst
Outdated
The list of returned columns can also be given as a comma-separated string to | ||
`~~astroquery.heasarc.HeasarcClass.query_region`: | ||
|
||
.. doctest-skip:: |
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 do we skip this?
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.
fixed
docs/heasarc/heasarc.rst
Outdated
>>> from astroquery.heasarc import Heasarc | ||
>>> heasarc = Heasarc() | ||
>>> table = heasarc.query_object(object_name, mission='rosmaster', radius='120 arcmin') | ||
>>> from astroquery.heasarc import Heasac |
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.
typo
>>> from astroquery.heasarc import Heasac | |
>>> from astroquery.heasarc import Heasarc |
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.
fixed here and in other places in the rst document.
docs/heasarc/heasarc.rst
Outdated
or a string that can be parsed into one (e.g., '1 degree' or 1*u.degree). The | ||
following are equivalent: | ||
Multiple keywords that are separated by space are joined with **AND**, so the | ||
following find all tables that have both 'xmm' and 'chandra' keyworkds: |
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.
typo
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.
fixed
This a major refactor of the
heasarc
module to use the VO interface to the archive. The main motivation is:The main changes inlcude:
The old class has been renamedHeasarcClass
->HeasarcBrowseClass
. The initialized instance is also renameHeasarc
->HeasarcBrowse
. The same for the test files.HeasarcClass
has been removed, and its main methods are included in the class with a deprecation message.HeasarcClass
class uses an interface similar to those used in other modules e.g. ipac.irsa.