I ran across this yesterday.
I type the following into a python REPL:
`
import numpy as np
import pint
ureg = pint.UnitRegistry()
Q_ = ureg.Quantity
theta = Q_(30, ureg.degrees)
type(theta.m) # returns int
s_theta = np.sin(theta)
type(theta.m) # returns numpy.ndarray
`
Printing theta, using comparisons, etc. doesn't show that anything has changed about it. I ran into trouble when I was saving an angle's magnitude to a JSON file, and json.dump complained that it didn't know how to write 'array(0.0)'. I worked backwards, and eventually isolated the point where the type of the angle's magnitude changed.
I ran across this yesterday.
I type the following into a python REPL:
`
import numpy as np
import pint
ureg = pint.UnitRegistry()
Q_ = ureg.Quantity
theta = Q_(30, ureg.degrees)
type(theta.m) # returns int
s_theta = np.sin(theta)
type(theta.m) # returns numpy.ndarray
`
Printing theta, using comparisons, etc. doesn't show that anything has changed about it. I ran into trouble when I was saving an angle's magnitude to a JSON file, and json.dump complained that it didn't know how to write 'array(0.0)'. I worked backwards, and eventually isolated the point where the type of the angle's magnitude changed.