Skip to content
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

Restore rectangle search #2663

Merged
merged 26 commits into from
Apr 28, 2023
Merged

Restore rectangle search #2663

merged 26 commits into from
Apr 28, 2023

Conversation

weaverba137
Copy link
Member

@weaverba137 weaverba137 commented Feb 10, 2023

This PR closes #2659. Rectangle searches are passed as a SQL query to query_sql().

  • Fix any existing broken tests.
  • Enable tests with rectangular search.
  • Test calling query_region() with either radius or width; not neither, not both.
  • Decide what defaults should be: e.g. what should happen if neither radius nor width are specified?
  • Decide on a definition of "rectangle": cos(dec) or not.
  • Verify that documentation is clear.
  • Change log, etc.

Other notes:

  • I rearranged some of the documentation sections, even in functions unrelated to this change, because they did not strictly follow numpydoc standards.
  • But it turns out that breaks async_to_sync, so I'll undo that for the purposes of this PR.

@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #2663 (dd63c3b) into main (766a4fc) will decrease coverage by 3.34%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2663      +/-   ##
==========================================
- Coverage   69.17%   65.83%   -3.34%     
==========================================
  Files         304      233      -71     
  Lines       22529    17892    -4637     
==========================================
- Hits        15585    11780    -3805     
+ Misses       6944     6112     -832     
Impacted Files Coverage Δ
astroquery/sdss/core.py 92.97% <100.00%> (+1.47%) ⬆️

... and 89 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@weaverba137
Copy link
Member Author

The async_to_sync functionality appears to assume that Returns is the last section of the docstring, but this violates the numpydoc standard. I'll eventually get around to restoring the Returns, but it would be more robust for async_to_sync to find and replace the Returns section, rather than just assuming it is at the end.

@keflavich
Copy link
Contributor

A fix to that incorrect assumption would be welcome!

@weaverba137
Copy link
Member Author

@keflavich, good, but I think I will keep that as a separate issue for now.

@weaverba137
Copy link
Member Author

@keflavich, I need some help on this one. I can no longer determine why async_to_sync is not producing compilable doc strings, even after I've restored the doc string sections as closely as possible to the state prior to this PR (as well as the last tag).

@keflavich
Copy link
Contributor

I see https://readthedocs.org/projects/astroquery/builds/19731041/ is the problem.

I'm not sure, but my first guess is that you've changed something like

"""
this
"""

to

"""this
"""

which has broken the dedent code?

I can dig a bit more later if that's not the soln

astroquery/sdss/core.py Outdated Show resolved Hide resolved
@keflavich
Copy link
Contributor

keflavich commented Mar 9, 2023 via email

@weaverba137
Copy link
Member Author

@keflavich, et al., I still need to do some updates to the remote data tests, but I think it is time to move this out of draft status and start thinking about the unchecked boxes above:

  • What should be the default for query_region() if neither radius nor width are specified? Currently it raises an exception.
  • What is the definition of "rectangle". Currently, I implemented an improved version of the original rectangle from the previous tag (now handles RA wrap-around!). It does not currently implement cos(dec) corrections.
  • Is the documentation sufficiently clear?

@weaverba137 weaverba137 marked this pull request as ready for review March 10, 2023 23:03
Copy link
Contributor

@keflavich keflavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be the default for query_region() if neither radius nor width are specified? Currently it raises an exception.

This is the right behavior

What is the definition of "rectangle". Currently, I implemented an improved version of the original rectangle from the previous tag (now handles RA wrap-around!). It does not currently implement cos(dec) corrections.

The current implementation is fine, but ...

Is the documentation sufficiently clear?

Yes, but include a note that the rectangle coordinates represent (ra +/- width, dec +/- height) as opposed to (ra +/- width/cos(dec), dec +/- height)

Otherwise, looks good. I put in some minor code readability suggestions - if they do not achieve the desired behavior, though, feel free to reject.

astroquery/sdss/core.py Outdated Show resolved Hide resolved
astroquery/sdss/core.py Outdated Show resolved Hide resolved
astroquery/sdss/core.py Outdated Show resolved Hide resolved
astroquery/sdss/core.py Outdated Show resolved Hide resolved
astroquery/sdss/core.py Outdated Show resolved Hide resolved
@weaverba137
Copy link
Member Author

@keflavich, I've implemented your suggestions and also run remote tests to verify those are working. The final step is updating the documentation.

@weaverba137
Copy link
Member Author

@keflavich, et al., I've added further details to the documentation and the change log. For some reason Codecov is saying the total coverage decreased, even though I increased the coverage of sdss/core.py to 100%. The largest decrease appears to be in cds/core.py, but I don't know why that is.

Copy link
Contributor

@keflavich keflavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the clarification text about the shape of the selection. I have two very minor suggestions but I think this is good to merge. I'm not really worried about the coverage decrease because it can't be related, but if anyone else has ideas, voice 'em

docs/sdss/sdss.rst Outdated Show resolved Hide resolved
docs/sdss/sdss.rst Outdated Show resolved Hide resolved
@weaverba137
Copy link
Member Author

OK, I've committed the last two suggestions.

@weaverba137
Copy link
Member Author

Reminder: this is waiting for final review.

@keflavich
Copy link
Contributor

@bsipocz I'm good with this, but I'm wary of hitting 'merge' without your eyes on it.

@bsipocz bsipocz added the sdss label Apr 28, 2023
@bsipocz bsipocz added this to the v0.4.7 milestone Apr 28, 2023
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, thanks!

@bsipocz bsipocz merged commit c5332fa into astropy:main Apr 28, 2023
7 of 8 checks passed
@weaverba137 weaverba137 deleted the restore-rectangle branch May 8, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-enable rectangular search for SDSS query_region
3 participants