-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Desi legacy survey #2210
base: main
Are you sure you want to change the base?
Desi legacy survey #2210
Conversation
Hello @burnout87! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-06-15 13:01:46 UTC |
As advised in #2192 , the various renamings have been applied |
Codecov Report
@@ Coverage Diff @@
## main #2210 +/- ##
==========================================
+ Coverage 63.95% 64.01% +0.05%
==========================================
Files 132 133 +1
Lines 16974 17009 +35
==========================================
+ Hits 10856 10888 +32
- Misses 6118 6121 +3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks. We still need a few things before this is merged:
|
@burnout87 - thanks for the PR. Before going into a more formal/thorough review, could you please rebase to get rid of the merge commits, as well as to squash the commits that add the test files? Those files need to be cut back a lot in size, currently, the new module's test data takes up 75+% of all of astroquery's size. Thanks! |
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 looking very good! Most of my comments are small, the two bigger items are:
- The examples in the docs don't run as-is.
- The async functions don't seem to actually be async, in that they don't return HTTP responses. They either need to follow the async API specs or not be called async.
My comment above still stands, please rebase/squash out the commits so bigger test files are not added and then removed in the history |
Thanks for your time. The first iteration of comments has been addressed. |
Once the last conversation will be resolved I will proceed to do that. |
2dac731
to
0a6e016
Compare
Commits squashing executed. |
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.
It's getting there, thanks.
Here is my first round of review, most of the items are minor, and are needed to fix the failures we see in CI, etc.
astroquery/desi/core.py
Outdated
---------- | ||
coordinates : str or `astropy.coordinates`. | ||
coordinates around which to query | ||
radius : str or `astropy.units.Quantity`. |
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.
add all the parameters to the docs, including the optional ones, too
>>> im = DESILegacySurvey.get_images(pos, data_release=9, radius=radius, pixels=pixels) | ||
|
||
.. code-block:: python | ||
|
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 need to write the whole example script as one big block, along with the output, have a look at the other modules (e.g. cadc or ipac.irsa) for examples. If you run the remote tests on this file, edit it until it passes. (python setup.py test -t docs/desi/desi.rst -R
)
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 believe this issue is still holding tests back from passing
@burnout87 - I'll come back to this later during the week for another round of review and minor fixes that would fix e.g. the docs build. |
0b4e1a5
to
7fd6402
Compare
Hi @bsipocz , I was wondering if you had time for the last round of review. We didnt interact during the last weeks, so I lost track of this. Thanks |
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.
Some major and minor nitpicking comments. I'm pushing the fix for the docs build separately as it's an automodapi peculiarity.
Also, as you've squashed down all the commits to one you lost the authorship credit. I'm happy to get some of that fixed by sorting out the duplicated commits/extra data etc squashes from the backup branch once we're otherwise ready to merge.
astroquery/desi/core.py
Outdated
coordinates : `astropy.coordinates` | ||
coordinates around which to query. | ||
radius : `astropy.units.Quantity` | ||
the radius of the cone search. |
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.
rephrase that this is a box search rather than a 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 still incorrectly specified in the docstring
astroquery/desi/core.py
Outdated
fits_file = file_container.get_fits() | ||
except (requests.exceptions.HTTPError, urllib.error.HTTPError) as e: | ||
fits_file = None | ||
warnings.warn(f"{str(e)} - Problem retrieving the file at the url: {image_url}", NoResultsWarning) |
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 sure you don't want to raise this as an exception? Why and when does this return an HTTPError?
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.
An HTTPError happens in the case of not valid inputs, more specifically when these are outside of the survey coverage.
We, for our internal applications, want to display a warning message in case this situation occurs.
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.
yes, my point is that if the URL throws an error then I think we should throw it, too. E.g. the user expects a file as a return, but here they get a valid return yet no files.
Is there any use case where this is more useful for the users than to receive an error?
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 server returns an HTTPError
in the case of internal error of the legacysurvey but also in the case I mentioned (ie case of not valid inputs, outside of the survey coverage), so at the moment is impossible for us to distinguish these two situations.
For this reason, we decided just to show the message in the warning to the user in both of those cases.
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.
Hi @bsipocz , what do you think? Does it make sense to you?
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.
It's OK to customize the message but my point still stands, it should the raised. I don't see a use case where a warning rather than an error is preferred after all the query errored out and the None
return is not really a valid results for these cases (None
return would be fine if there is a valid query and there is no match for ti in the DB, etc.)
Thanks! I was not considering that when doing the squash. |
fits_file = file_container.get_fits() | ||
except (requests.exceptions.HTTPError, urllib.error.HTTPError) as exp: | ||
fits_file = None | ||
warnings.warn(f"{str(exp)} - Problem retrieving the file at the url: {image_url}", NoResultsWarning) |
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.
Following @bsipocz 's unresolved comment: if the download was unsuccessful, we should raise an Exception.
warnings.warn(f"{str(exp)} - Problem retrieving the file at the url: {image_url}", NoResultsWarning) | |
raise urllib.error.HTTPError(f"{str(exp)} - Problem retrieving the file at the url: {image_url}") |
I'm a bit confused by our current error: |
astroquery/desi/core.py
Outdated
|
||
class DESILegacySurveyClass(BaseQuery): | ||
|
||
def query_region(self, coordinates, radius=0.5*u.arcmin, *, data_release=9): |
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.
There was a suggestion earlier to make radius
an optional keyword argument, like this:
def query_region(self, coordinates, radius=0.5*u.arcmin, *, data_release=9): | |
def query_region(self, coordinates, *, radius=0.5*u.arcmin, data_release=9): |
I resolved the conversation unintentionally, but I'll re-raise it now: is there any reason not to have it be optional?
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.
In some modules the region can be a circle or a rectangle, and in those cases radius
should definitely be a keyword-only argument. Although here the region can only be a circle, it might still better to make it a keyword-only argument for consistency's sake with the other sub-packages, and to make it very explicit to all users that the region is indeed a circle and not a rectangle.
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.
...actually it is a (projected) square, so radius
is the wrong kwarg.
def query_region(self, coordinates, radius=0.5*u.arcmin, *, data_release=9): | |
def query_region(self, coordinates, width=0.5*u.arcmin, *, data_release=9): |
Probably this should be refactored to have width
and height
, and maybe even specifically ra_width
and dec_height
, as arguments.
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 comment still needs to be addressed. Also, keep the width
mandatory, too by moving the ,* ,
one place forward as it was suggested in the earlier comment.
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.
There are some minor nitpicks. The biggest issue is that the remote test takes a really long time.
OTOH, I went ahead and rebased, so will go ahead, push that rebase to see how the CI react as well as I'll push one minor commit that addresses my comments.
docs/desi/desi.rst
Outdated
>>> coordinates = SkyCoord(ra, dec, unit='degree') | ||
>>> radius = Angle(5, unit='arcmin') | ||
>>> table_out = DESILegacySurvey.query_region(coordinates, radius, data_release=9) | ||
>>> print(table_out[:5]) |
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 doctest fails from here on
|
||
|
||
@pytest.mark.remote_data | ||
class TestLegacySurveyClass: |
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.
Remote tests take a really long time, they need to be significantly cut back (probably a smaller query would do it? I haven't tried)
@pytest.mark.parametrize("valid_inputs", [True, False]) | ||
def test_get_images(self, valid_inputs): | ||
|
||
if valid_inputs: |
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 parametrize on the variables rather than on a boolean. There are plenty of examples in the other modules
radius = Angle(radius_input, unit='arcmin') | ||
|
||
if valid_inputs: | ||
query1 = DESILegacySurvey.get_images(pos, pixels, radius, data_release=9) |
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 about testing for other data releases?
astroquery/desi/core.py
Outdated
|
||
class DESILegacySurveyClass(BaseQuery): | ||
|
||
def query_region(self, coordinates, radius=0.5*u.arcmin, *, data_release=9): |
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 comment still needs to be addressed. Also, keep the width
mandatory, too by moving the ,* ,
one place forward as it was suggested in the earlier comment.
daf32fe
to
c9accc3
Compare
c9accc3
to
7cc8d8b
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.
The case when only the mandatory arguments are used are not tested, and actually raise exceptions. The code should be fixed to handle the case to fall back to the default width and pixels.
Also, pixels
are not documented, please add a one liner to the docstring.
@burnout87 - This is rather close to be able to be merged, but currently there are a few cases where the code run into regression. Also, it would be nice to actually test more of the parameter space of the possible input values, e.g. the used data release is very much hardwired. I expect all this remaining stuff can be fixed with a reasonably straightforward commit, but do let us know if there are any questions. |
DR10 for DESI LS just came out in December 2022. It would be great to be able to access the DR10 data via a similar command |
No description provided.