You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrap_angle attribute does not pickle properly with Longitude instance #1942
So the wrap_angle attribute for a Longitude instance is used several times in the angle class, yet it does not pickle properly. See below for a simple example.
Scott
In [1]: from astropy.coordinates import Longitude, Latitude
In [2]: import cPickle
In [3]: a = Longitude(1.23, "radian", wrap_angle='180d')
In [4]: a.wrap_angle
Out[4]: <Angle 180.0 deg>
In [5]: cPickle.dump(a, open("xxx", "wb"))
In [6]: b = cPickle.load(open("xxx"))
In [7]: a
Out[7]: <Longitude 1.2300000000000004 rad>
In [8]: b
Out[8]: <Longitude 1.2300000000000004 rad>
In [9]: b.wrap_angle
ERROR: AttributeError: Longitude instance has no attribute 'wrap_angle' [astropy.units.quantity]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-c854be2560b1> in <module>()
----> 1 b.wrap_angle
/home/sransom/src/astropy_dev/astropy/units/quantity.pyc in __getattr__(self, attr)
574 raise AttributeError(
575 "{0} instance has no attribute '{1}'".format(
--> 576 self.__class__.__name__, attr))
577 else:
578 return value
AttributeError: Longitude instance has no attribute 'wrap_angle'
Activity
Fix for astropy#1942. Added pickling test class for coordinates as well
Merge pull request #1961 from ryanfox/wrap-angle-pickling
mhvk commentedon Jan 21, 2014
Closed by #1961
Merge pull request #1961 from ryanfox/wrap-angle-pickling
Merge pull request #1961 from ryanfox/wrap-angle-pickling
Merge pull request #1961 from ryanfox/wrap-angle-pickling
Fix for astropy#1942. Added pickling test class for coordinates as well