Skip to content

(re-)Add astrometry.net#1163

Merged
keflavich merged 66 commits intoastropy:masterfrom
mwcraig:astrometry_net_update
Aug 2, 2019
Merged

(re-)Add astrometry.net#1163
keflavich merged 66 commits intoastropy:masterfrom
mwcraig:astrometry_net_update

Conversation

@mwcraig
Copy link
Copy Markdown
Member

@mwcraig mwcraig commented Jun 7, 2018

This PR replaces #521 (but does include all of the commits from that PR with proper attribution). I'll add a test that checks the solution for the small data file I've added later tonight.

The intent is that there also be a solve_from_image method or something that uploads an image for astrometry.net to do the source detection.

I'd like a better way of managing all of the options, but this is a start....

To do

  • Add API key for astrometry.net

@astropy-bot
Copy link
Copy Markdown

astropy-bot bot commented Jun 7, 2018

Check results are now reported in the status checks at the bottom of this page.

@pep8speaks
Copy link
Copy Markdown

pep8speaks commented Jun 7, 2018

Hello @mwcraig! 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 2019-08-02 01:39:32 UTC

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 7, 2018

Codecov Report

Merging #1163 into master will decrease coverage by 0.14%.
The diff coverage is 52.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1163      +/-   ##
==========================================
- Coverage   62.61%   62.47%   -0.15%     
==========================================
  Files         174      176       +2     
  Lines       14413    14612     +199     
==========================================
+ Hits         9025     9129     +104     
- Misses       5388     5483      +95
Impacted Files Coverage Δ
astroquery/astrometry_net/__init__.py 100% <100%> (ø)
astroquery/astrometry_net/core.py 50% <50%> (ø)

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 2d1ee6f...378360e. Read the comment docs.

@bsipocz bsipocz added this to the v0.3.9 milestone Jun 7, 2018
Copy link
Copy Markdown
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.

Initial review. Only minor comments so far.

@bsipocz bsipocz force-pushed the master branch 2 times, most recently from ab0c591 to 712c326 Compare June 8, 2018 12:58
@keflavich
Copy link
Copy Markdown
Contributor

@mwcraig - just ping us when this is ready for further review

@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Aug 19, 2018

(still working on this but wanted to push some updates)

@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Aug 21, 2018

I could use some feedback on how to structure the arguments for the two methods here. The challenge is that each method (solve_from_source_list, solve_from_image) has a few parameters that are specific to the method (e.g. x, y for the source list, name of the image file for the image) and a whole bunch of parameters related to the plate solve that are the same.

Two approaches I can see:

  • One function that takes the union of all the settings and dispatches the actual solve to internal functions. Advantage: all of the settings are in one place. Disadvantage: messy logic inside this method, potential user confusion about which combinations of parameters they must set.
  • Two methods with the settings factor out in some way (maybe the settings are properties of the instance? something else?).

I just pushed a version which sort of does the second but I'm not sure I like the approach I took of adding a show_allowed_settings method and an empty_settings property (to make it easier to set up a dict of the options).

@keflavich
Copy link
Copy Markdown
Contributor

I prefer two methods with common settings factored out. Will look at the code too...

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

The approach you've taken seems fine for now, but I haven't seen it in action

@bsipocz bsipocz self-requested a review September 6, 2018 00:06
@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Sep 24, 2018

Still working on the documentation, but the code is just about done...

@mwcraig mwcraig force-pushed the astrometry_net_update branch from 229e5a9 to 83b5fc7 Compare September 29, 2018 20:04
@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Sep 29, 2018

@keflavich @bsipocz -- this is ready for review, though there are still a few things to be fixed before merging:

  • Add an API key for running the remote tests.
  • Add instructions for adding API key to config and/or keyring, and
  • add code for retrieving API key from keyring if keyring is used.
  • Decide whether to change examples to match tests (then users can download sample catalogs/images)
  • Maybe add RA/Dec to the test for searching by list to speed up the solution.

@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Sep 29, 2018

@dstndstn -- this PR adds a Python interface to astrometry.net. I have a question -- what is the appropriate rate at which to query the server to see if it is done with a solution? Right now it simply checks every second (see https://github.com/astropy/astroquery/pull/1163/files#diff-93fb4c4b0964e0725414e59df9f4150dR229 ) but I could make it less aggressive. (and thanks again for the service!)

@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Sep 30, 2018

Question about coverage -- many the bits being reported by codecov as uncovered are actually covered by the remote data tests. Should I be mocking up the remote or something and writing non-remote tests for those things (the methods _login, monitor_submission, solve_from_source_list, solve_from_image)?

Will, of course, write additional tests for everything that clearly does not require remote.

@keflavich
Copy link
Copy Markdown
Contributor

@mwcraig - I will review this if I can find time, but it's a big one and I'm pretty preoccupied. I hope I'll find time this week....

On coverage, we just don't measure the coverage of remote tests, unfortunately.

@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Oct 1, 2018

No big rush; I'll check the coverage locally with the remote tests running. Let me know if you want me to try mocking up some tests.

@bsipocz
Copy link
Copy Markdown
Member

bsipocz commented Oct 1, 2018

@mwcraig - I'm also snowed it quite badly, but will try to find time to do a review. As for coverage, don't worry that much about mocking for things where local testing is not sensible.
I have high hopes to refactor the CI infrastructure, and then we may hopefully be able to coverage test more jobs etc. that may improve the current situation.

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

minor things only

def api_key(self):
""" Return the Astrometry.net API key. """
if not conf.api_key:
log.error("Astrometry.net API key not in configuration file")
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.

is the api key required? if so, raise instead of log this error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

An error is raised if you do any operation that requires the api key (all communication with astrometry.net goes through _login, which raises an error). Here the user gets a warning if they try accessing the attribute.

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.

would that be possible to get an API key for testing? We ideally need something for CI cron tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes; we'd need to set up an account on astrometry.net. I'll do that this morning and pass the credentials off to @bsipocz for CI encryption.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

API key has been sent

The contents of the returned object depend on whether the solve
succeeds or fails. If the solve succeeds the header with
the WCS solution generated by astrometry.net is returned. If the solve
fails then an empty dictionary is returned. See below for the outcome
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.

why an empty dict?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't remember why I did an empty dict instead of None; happy to change.

@bsipocz
Copy link
Copy Markdown
Member

bsipocz commented Dec 5, 2018

@mwcraig - Could you rebase one more time to clear up the unrelated test failures?

@mwcraig mwcraig force-pushed the astrometry_net_update branch from ce209a5 to 15547d5 Compare December 5, 2018 21:05
@mwcraig
Copy link
Copy Markdown
Member Author

mwcraig commented Dec 5, 2018

@bsipocz -- rebased

mwcraig added 28 commits August 1, 2019 21:39
These apply to one type of source input (a list) and are not general settings like the rest
🤦‍♂️
@mwcraig mwcraig force-pushed the astrometry_net_update branch from 8d60cce to 378360e Compare August 2, 2019 01:39
@keflavich keflavich merged commit ec841e2 into astropy:master Aug 2, 2019
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.

5 participants