astropy / pyvo

An Astropy affiliated package providing access to remote data and services of the Virtual Observatory (VO) using Python.
https://pyvo.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
77 stars 52 forks source link

Unable to work through "Getting Started With PyVO" #30

Closed jimaples closed 11 years ago

jimaples commented 11 years ago

I recently watched the SciPy presentation and as a fan of astronomy and Python, I was thinking of using PyVO and matplotlib to generate large-format images for desktop images or prints. I was looking at the "Getting Started With PyVO" but didn't get very far as the error below shows.

I'm working in IPython Notebook with Python 2.7.5, PyVO 0.0beta1, and astropy 0.2.3.

import pyvo as vo

vo.object2pos('Cas A')
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-18-00423082c713> in <module>()
      1 import pyvo as vo
      2 
----> 3 vo.object2pos('Cas A')

C:\Anaconda\lib\site-packages\pyvo\nameresolver\sesame.pyc in object2pos(names, db, mirror)
    127        *list* of tuples: if a list of names was given
    128     """
--> 129     targetdata = resolve(names, db, mirror=mirror)
    130     if isinstance(targetdata, list):
    131         return map(lambda t: t.pos, targetdata)

C:\Anaconda\lib\site-packages\pyvo\nameresolver\sesame.pyc in resolve(names, db, include, mirror)
    104     out = []
    105     for t in targets:
--> 106         out.append(t.responses[0])
    107 
    108     if isinstance(names, list):

IndexError: tuple index out of range

ERROR: IndexError: tuple index out of range [pyvo.nameresolver.sesame]
augustfly commented 11 years ago

I bet the name resolver was down. Did you try again? It worked for me today.

config:

In [6]: print pyvo.__version__
0.0.dev129
In [7]: pyvo.object2pos('Cas A')
Out[7]: (350.85, 58.815)
In [10]: print sys.version
2.7.5 (default, Sep 24 2013, 15:17:51) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.76)]
RayPlante commented 11 years ago

While Gus is probably right (it's working for me now, too), a better failure would be helpful. I'll look into better detecting a failed response.

jimaples commented 11 years ago

Thanks for the quick response, it worked just fine today. Now if astropy would actually open the *.fits image that got downloaded, I'd be set.