astropy/astropy — pull request #891 by eteq (2013-04-03 01:08:27+00:00)
Title: Bug with coordinate separation

The following example shows a bug in the ``separation()`` method for ``astropy.coordinates``:

```
In [8]: from astropy.coordinates import FK5Coordinates

In [9]: a = FK5Coordinates(1., 1., unit=('deg', 'deg'))

In [10]: b = FK5Coordinates(2., 2., unit=('deg', 'deg'))

In [11]: a.separation(b)
ERROR: TypeError: __new__() takes at least 2 arguments (1 given) [copyreg]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 a.separation(b)

/Volumes/Raptor/Library/Python/3.2/lib/python/site-packages/astropy-0.3.dev3643-py3.2-macosx-10.8-x86_64.egg/astropy/coordinates/coordsystems.py in separation(self, other)
385 The on-sky separation between this and the `other` coordinate.
386 """
--> 387 other_in_self_system = other.transform_to(self.__class__)
388
389 lat1 = self.latangle.radians

/Volumes/Raptor/Library/Python/3.2/lib/python/site-packages/astropy-0.3.dev3643-py3.2-macosx-10.8-x86_64.egg/astropy/coordinates/coordsystems.py in transform_to(self, tosys)
458
459 if tosys is self.__class__:
--> 460 return deepcopy(self)
461
462 trans = master_transform_graph.get_transform(self.__class__, tosys)

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in deepcopy(x, memo, _nil)
172 raise Error(
173 "un(deep)copyable object of type %s" % cls)
--> 174 y = _reconstruct(x, rv, 1, memo)
175
176 memo[d] = y

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in _reconstruct(x, info, deep, memo)
288 if state:
289 if deep:
--> 290 state = deepcopy(state, memo)
291 if hasattr(y, '__setstate__'):
292 y.__setstate__(state)

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in deepcopy(x, memo, _nil)
145 copier = _deepcopy_dispatch.get(cls)
146 if copier:
--> 147 y = copier(x, memo)
148 else:
149 try:

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in _deepcopy_dict(x, memo)
234 memo[id(x)] = y
235 for key, value in x.items():
--> 236 y[deepcopy(key, memo)] = deepcopy(value, memo)
237 return y
238 d[dict] = _deepcopy_dict

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in deepcopy(x, memo, _nil)
172 raise Error(
173 "un(deep)copyable object of type %s" % cls)
--> 174 y = _reconstruct(x, rv, 1, memo)
175
176 memo[d] = y

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copy.py in _reconstruct(x, info, deep, memo)
283 if deep:
284 args = deepcopy(args, memo)
--> 285 y = callable(*args)
286 memo[id(x)] = y
287

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/copyreg.py in __newobj__(cls, *args)
86
87 def __newobj__(cls, *args):
---> 88 return cls.__new__(cls, *args)
89
90 def _slotnames(cls):

TypeError: __new__() takes at least 2 arguments (1 given)
```

(occurs with Python 2 and 3).