dstndstn / astrometry.net

Astrometry.net -- automatic recognition of astronomical images
http://astrometry.net
Other
682 stars 189 forks source link

API Cient Examples in astronomy/net/client/examples Do Not Work #146

Closed exowanderer closed 5 years ago

exowanderer commented 5 years ago

I am trying to use the astrometry.net API to examine a stack of new images. Using the website one at a time for 100+ images is too much button pushing.

I cloned the github repo, installed the code, and downloaded catalogue files; but the solutions are wrong: the WCS is no where near the actual RA and Dec of the field; this results in a blank image subtraction because the reference frame is being "projected" out of view.

So I had to start using the website directly and came across the API.


Unfortunately, the API is not working for 2 independent reasons:

(1) the python package does not include astrometry.net.client. That is, if I follow the example apod.py then the following error is generated:

Traceback (most recent call last):
  File "examples/apod.py", line 14, in <module>
    from astrometry.net.client import Client
ModuleNotFoundError: No module named 'astrometry.net'

(2) If I try to run the client.py from the bash terminal, using the examples/rc3.sh example, the following error is flagged:

python $HOME/path/to/github/astrometry.net/net/client/client.py \ --server http://staging.astrometry.net/api/ \ --apikey MY_APIKEY \ --upload $HOME/path/to/fits_filename.fits

Running with args ['$HOME/path/to/github/astrometry.net/net/client/client.py', '--server', 'http://staging.astrometry.net/api/', '--apikey', 'MY_APIKEY', '--upload', '$HOME/path/to/fits_filename.fits']
Python: {'apikey': 'MY_APIKEY'}
Sending json: {"apikey": "MY_APIKEY"}
Sending to URL: http://staging.astrometry.net/api/login
Sending form data: {'request-json': '{"apikey": "MY_APIKEY"}'}
Sending data: b'request-json=%7B%22apikey%22%3A+%22MY_APIKEY%22%7D'
HTTPError HTTP Error 404: Not Found
Wrote error text to err.html
Traceback (most recent call last):
  File "$HOME/path/to/github/astrometry.net/net/client/client.py", line 353, in <module>
    c.login(opt.apikey)
  File "$HOME/path/to/github/astrometry.net/net/client/client.py", line 147, in login
    sess = result.get('session')
AttributeError: 'NoneType' object has no attribute 'get'
dstndstn commented 5 years ago

Hi,

Regarding your incorrect solutions using the code: could you please file a separate issue about that. We consider false positives to be an extremely bad outcome, so I would like to follow up this failure. At a minimum, please include an example image, the command line you are using, and the list of index files you have.

About the client.py script -- you're right, it wasn't being installed. I just fixed that in 8b180f01.

The rc3.sh script (which hasn't been touched in 7 years...) was using the "staging" version of the web site -- a testing ground that is not always running. I just updated that to use the production "nova" site.

Using the client requires only two arguments in the simplest form --

python astrometry/net/client/client.py --apikey YOUR_API_KEY --upload FILENAME

and it is stand-alone -- it doesn't require any other code from the astrometry.net code base.

Thanks for the bug report.

cheers, --dustin

exowanderer commented 5 years ago

That was incredibly helpful; thank you!

I'll submit a new issue for the false positives. I have 20-25% of my images result in false positives. My team is right now reanalyzing those with the updated github (old version circa February 2018). I'll let you know if we get the same errors. Note: It is currently "still processing" after far too long.

I'll put all that in a different issue.