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

Hubble related members #2268

Merged
merged 12 commits into from
Mar 2, 2022
Merged

Conversation

javier-ballester
Copy link
Contributor

These changes allow users to get related members of HST and HAP observations. Query_target method has been refactored to use the TAP instead of AIO.

@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #2268 (98368e0) into main (f56d13a) will increase coverage by 0.01%.
The diff coverage is 95.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2268      +/-   ##
==========================================
+ Coverage   63.08%   63.09%   +0.01%     
==========================================
  Files         131      131              
  Lines       17005    17037      +32     
==========================================
+ Hits        10728    10750      +22     
- Misses       6277     6287      +10     
Impacted Files Coverage Δ
astroquery/esa/hubble/core.py 86.12% <95.00%> (+2.55%) ⬆️
astroquery/utils/tap/model/modelutils.py 51.85% <0.00%> (-40.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f56d13a...98368e0. Read the comment docs.

@javier-ballester
Copy link
Contributor Author

Dear Astroquery team,

Please let me know if there are any changes you see are necessary for the acceptance of the pull request.

Many thanks,

Javier B

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.

There are some public-facing functions that could use docstrings, otherwise this is fine.

I'll note that we have an open issue here we should correct - async in the astroquery API is supposed to be a separate function, not something specified as a keyword argument. That doesn't need to be fixed here, but we'd like the interface to be consistent.

astroquery/esa/hubble/core.py Show resolved Hide resolved
astroquery/esa/hubble/core.py Show resolved Hide resolved
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.

There are some duplicated commits, as well as a minor changelog conflict. Could you please rebase? (Interactive rebase is needed for removing the duplicates, if that's the only remaining issue I'm happy to do it for this PR).

My comments are mainly minor things and opportunities for some code cleanups. There is one API change that is somewhat critical to be addressed before merging this.

astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
@bsipocz bsipocz added this to the v0.4.6 milestone Feb 25, 2022
@javier-ballester
Copy link
Contributor Author

Dear @bsipocz,

Thank you for all the corrections. I have tried to solve all of them but let me know if anything is missing.

Many thanks,

Javier B

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.

Thanks for the changes. There is one new bug, I tried to suggest the code changes for it, and please add a test case that covers that scenario. Otherwise it all looks good.

astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
@@ -380,7 +465,11 @@ def cone_search_criteria(self, radius, target=None,
raise TypeError("Please use only target or coordinates as"
"parameter.")
if target:
ra, dec = self._query_tap_target(target)
coord = self._query_tap_target(target)
ra = coord.get('RA_DEGREES')
Copy link
Member

Choose a reason for hiding this comment

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

The get() lines won't work with SkyCoords (as I see you indeed changed _query_tap_target() to return a skycoord). So this whole conditional could be simplified a little.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a test that tests this use case, so CI can pick it up, too.

In [4]: ESAHubble.cone_search_criteria(target='M11', radius=1)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-be2eb514e1e9> in <module>
----> 1 ESAHubble.cone_search_criteria(target='M11', radius=1)

~/munka/devel/worktrees/astroquery/testings/astroquery/esa/hubble/core.py in cone_search_criteria(self, radius, target, coordinates, calibration_level, data_product_type, intent, obs_collection, instrument_name, filters, async_job, filename, output_format, save, cache, verbose)
    467         if target:
    468             coord = self._query_tap_target(target)
--> 469             ra = coord.get('RA_DEGREES')
    470             dec = coord.get('DEC_DEGREES')
    471 

~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/astropy/coordinates/sky_coordinate.py in __getattr__(self, attr)
    856 
    857         # Fail
--> 858         raise AttributeError("'{}' object has no attribute '{}'"
    859                              .format(self.__class__.__name__, attr))
    860 

AttributeError: 'SkyCoord' object has no attribute 'get'

astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
astroquery/esa/hubble/core.py Show resolved Hide resolved
astroquery/esa/hubble/core.py Outdated Show resolved Hide resolved
@javier-ballester
Copy link
Contributor Author

Hi @bsipocz,

I have added the changes you have requested and have added additional unit tests to cone_search_criteria to cover the missing test cases.

Many thanks,

Javier

@bsipocz bsipocz merged commit 5258370 into astropy:main Mar 2, 2022
@bsipocz
Copy link
Member

bsipocz commented Mar 2, 2022

Thank you @javier-ballester!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants