[AstroPy] question about RotateNative2Celestial
Martin Beroiz
martinberoiz at gmail.com
Mon Sep 9 11:20:05 EDT 2019
Hello,
I’m toying a little with WCS and the functions on astropy.modeling.rotations.
I’m not sure if I found a bug or if I don’t understand yet the API for RotateNative2Celestial
Here’s the small example that I came up with and the traceback I get
from astropy.modeling import rotations as r
lon = 100.00
lat = -63.00
alpha_c = 100.00
delta_c = -63.00
lon_pole = 180.0
n2c = r.RotateNative2Celestial(lon, lat, lon_pole)
n2c.evaluate(0., 90., lon, lat, lon_pole)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-0a1e86053054> in <module>
----> 1 n2c.evaluate(0., 90., lon, lat, lon_pole)
~/anaconda3/lib/python3.7/site-packages/astropy/modeling/rotations.py in evaluate(self, phi_N, theta_N, lon, lat, lon_pole)
252 theta = - (np.pi / 2 - lat)
253 psi = -(np.pi / 2 + lon)
--> 254 alpha_C, delta_C = super()._evaluate(phi_N, theta_N, phi, theta, psi)
255 return alpha_C, delta_C
256
~/anaconda3/lib/python3.7/site-packages/astropy/modeling/rotations.py in _evaluate(self, phi, theta, lon, lat, lon_pole)
183 def _evaluate(self, phi, theta, lon, lat, lon_pole):
184 alpha, delta = super().evaluate(phi, theta, lon, lat, lon_pole,
--> 185 self.axes_order)
186 mask = alpha < 0
187 if isinstance(mask, np.ndarray):
~/anaconda3/lib/python3.7/site-packages/astropy/modeling/rotations.py in evaluate(self, alpha, delta, phi, theta, psi, axes_order)
89 shape = alpha.shape
90 inp = self.spherical2cartesian(alpha, delta)
---> 91 matrix = self._create_matrix(phi, theta, psi, axes_order)
92 result = np.dot(matrix, inp)
93 a, b = self.cartesian2spherical(*result)
~/anaconda3/lib/python3.7/site-packages/astropy/modeling/rotations.py in _create_matrix(self, phi, theta, psi, axes_order)
47 if isinstance(angle, u.Quantity):
48 angle = angle.value
---> 49 angle = angle.item()
50 matrices.append(rotation_matrix(angle, axis, unit=u.rad))
51 result = matrix_product(*matrices[::-1])
AttributeError: 'float' object has no attribute 'item'
I don't understand why it is expecting `angle` to have the `item` attribute.
Does anyone know what I'm doing wrong? Any help would be much appreciated.
Thanks!
M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190909/9faf5676/attachment-0001.html>
More information about the AstroPy
mailing list