-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Description
There is a change in behavior between Astropy 3.2 and Astropy 4.0 that is breaking some of our code. I'm flagging this in case it wasn't deliberate:
Astropy 3:
>>> import astropy.units as u
>>> import numpy
>>> a = 5 * u.s
>>> type(a.value)
<class 'float'>
Astropy 4
>>> import astropy.units as u
>>> import numpy
>>> a = 5 * u.s
>>> type(a.value)
<class 'numpy.float64'>
So for scalar quantities the type has changed from standard float to numpy float.
It's entirely possible that this is deliberate so that array values and scalar values have the same type. I was asked to file this on Slack just in case it was a side effect of something.
The impact for us is that something which serialized to YAML without any issue now breaks because YAML does not understand what to do with a numpy object. We can of course fix our code to trap this case.
cc/ @mhvk