astropy/astropy — pull request #2720 by barentsen (2014-07-10 16:24:39+00:00)
Title: 0.4rc1: conesearch broken & documentation outdated

`conesearch.conesearch()` appears to be broken in 0.4rc1:

```
In [1]: from astropy.vo.client import conesearch
In [2]: from astropy.coordinates import SkyCoord
In [3]: from astropy import units as u
In [4]: my_catname = 'Two Micron All Sky Survey (2MASS) 1'
In [5]: c = SkyCoord.from_name('M31')
In [6]: result = conesearch.conesearch(c, 0.1 * u.degree, catalog_db=my_catname)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
in ()
----> 1 result = conesearch.conesearch(c, 0.1 * u.degree, catalog_db=my_catname)

/home/gb/bin/anaconda/lib/python2.7/site-packages/astropy-0.4rc2.dev9406-py2.7-linux-x86_64.egg/astropy/vo/client/conesearch.pyc in conesearch(center, radius, verb, **kwargs)
189
190 return vos_catalog.call_vo_service(conf.conesearch_dbname,
--> 191 kwargs=args, **kwargs)
192
193

/home/gb/bin/anaconda/lib/python2.7/site-packages/astropy-0.4rc2.dev9406-py2.7-linux-x86_64.egg/astropy/vo/client/vos_catalog.pyc in call_vo_service(service_type, catalog_db, pedantic, verbose, cache, kwargs)
846
847 if pedantic is None: # pragma: no cover
--> 848 pedantic = votable.conf.pedantic
849
850 for name, catalog in catalogs:

NameError: global name 'votable' is not defined
```

The attached pull request fixes this bug. I believe it was not spotted by the tests, because all of them pass `pedantic` as an explicit argument to `conesearch.conesearch()` and hence did not cover the line that failed.

On a related note, this pull request also fixes three examples given in `docs/vo/conesearch/index.rst` and `docs/vo/conesearch/client.rst` which still use this old way of resolving coordinates by name, which no longer works:

```
In [1]: from astropy.coordinates import ICRS
In [2]: c = ICRS.from_name('M31')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 c = ICRS.from_name('M31')

AttributeError: type object 'ICRS' has no attribute 'from_name'
```

This pull request changes the documentation to use `coordinates.SkyCoord.from_name('M31')` instead, which appears to be the new way of resolving names. **Note that `ICRS.from_name()` appears to have been removed without deprecation warning? (Which took me by surprise.)**