Skip to content

Hubble related members#2268

Merged
bsipocz merged 12 commits into
astropy:mainfrom
esdc-esac-esa-int:hubble_related_members
Mar 2, 2022
Merged

Hubble related members#2268
bsipocz merged 12 commits into
astropy:mainfrom
esdc-esac-esa-int:hubble_related_members

Conversation

@javier-ballester

Copy link
Copy Markdown
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

codecov Bot commented Jan 31, 2022

Copy link
Copy Markdown

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
Copy Markdown
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

@keflavich keflavich left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread astroquery/esa/hubble/core.py
Comment thread astroquery/esa/hubble/core.py

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

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.

Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
@bsipocz bsipocz added this to the v0.4.6 milestone Feb 25, 2022
@javier-ballester

Copy link
Copy Markdown
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

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

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.

Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py Outdated
if target:
ra, dec = self._query_tap_target(target)
coord = self._query_tap_target(target)
ra = coord.get('RA_DEGREES')

Copy link
Copy Markdown
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
Copy Markdown
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'

Comment thread astroquery/esa/hubble/core.py Outdated
Comment thread astroquery/esa/hubble/core.py
Comment thread astroquery/esa/hubble/core.py Outdated
@javier-ballester

Copy link
Copy Markdown
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

bsipocz commented Mar 2, 2022

Copy link
Copy Markdown
Member

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.

3 participants