aplpy/aplpy — pull request #114 by hamogu (2013-05-08 03:40:45+00:00)
Title: Make world2pix and pix2worled more flexible, add tests

Currently, world2pix fails if the coordinates are passed as an
astropy.Column:
```
>>> from aplpy.tests.helpers import generate_wcs
>>> header_dir = os.path.join(os.path.dirname(os.path.abspath(aplpy.tests.helpers.__file__)), 'data/2d_fits')
>>> REFERENCE = os.path.join(header_dir, '1904-66_TAN.hdr')
>>> wcs = generate_wcs(REFERENCE)
>>> f = aplpy.FITSFigure(wcs)
>>> tab = Table({'RA':[347.,349.], 'DEC':[-68.,-68]})
>>> f.show_markers(tab['RA'], tab['DEC'])
ERROR: Exception: world2pix should be provided either with two scalars, two lists, or two numpy arrays [aplpy.wcs_util]
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/home/moritz/Dropbox/code/python/APLpy/ in ()
----> 1 f.show_markers(tab['RA'],tab['DEC'])

/home/moritz/Dropbox/code/python/APLpy/aplpy/aplpy.pyc in show_markers(self, xw, yw, layer, **kwargs)

/home/moritz/Dropbox/code/python/APLpy/aplpy/decorators.pyc in _auto_refresh(f, *args, **kwargs)
23 mydata.nesting = getattr(mydata, 'nesting', 0) + 1
24 try:
---> 25 f(*args, **kwargs)
26 finally:
27 mydata.nesting -= 1

/home/moritz/Dropbox/code/python/APLpy/aplpy/aplpy.pyc in show_markers(self, xw, yw, layer, **kwargs)
957 self.remove_layer(layer, raise_exception=False)
958
--> 959 xp, yp = wcs_util.world2pix(self._wcs, xw, yw)
960 s = self._ax1.scatter(xp, yp, **kwargs)
961

/home/moritz/Dropbox/code/python/APLpy/aplpy/wcs_util.pyc in world2pix(wcs, x_world, y_world)
456 return wcs.wcs_sky2pix(x_world, y_world, 1)
457 else:
--> 458 raise Exception("world2pix should be provided either with two scalars, two lists, or two numpy arrays")
459
460

Exception: world2pix should be provided either with two scalars, two lists, or two numpy arrays
```

This pull request solves that issue.