# healpy.rotator.Rotator¶

class `healpy.rotator.``Rotator`(rot=None, coord=None, inv=None, deg=True, eulertype='ZYX')

Rotation operator, including astronomical coordinate systems.

This class provides tools for spherical rotations. It is meant to be used in the healpy library for plotting, and for this reason reflects the convention used in the Healpix IDL library.

Parameters: rot : None or sequence Describe the rotation by its euler angle. See `euler_matrix_new()`. coord : None or sequence of str Describe the coordinate system transform. If rot is also given, the coordinate transform is applied first, and then the rotation. inv : bool If True, the inverse rotation is defined. (Default: False) deg : bool If True, angles are assumed to be in degree. (Default: True) eulertype : str The Euler angle convention used. See `euler_matrix_new()`.

Examples

```>>> r = Rotator(coord=['G','E'])  # Transforms galactic to ecliptic coordinates
>>> theta_gal, phi_gal = np.pi/2., 0.
>>> theta_ecl, phi_ecl = r(theta_gal, phi_gal)  # Apply the conversion
>>> print(theta_ecl)
1.66742286715
>>> print(phi_ecl)
-1.62596400306
>>> theta_ecl, phi_ecl = Rotator(coord='ge')(theta_gal, phi_gal) # In one line
>>> print(theta_ecl)
1.66742286715
>>> print(phi_ecl)
-1.62596400306
>>> vec_gal = np.array([1, 0, 0]) #Using vectors
>>> vec_ecl = r(vec_gal)
>>> print(vec_ecl)
[-0.05488249 -0.99382103 -0.09647625]
```

Attributes

 `mat` The matrix representing the rotation. `coordin` The input coordinate system. `coordout` The output coordinate system. `coordinstr` The input coordinate system in str. `coordoutstr` The output coordinate system in str. `rots` The sequence of rots defining the rotation. `coords` The sequence of coords defining the rotation.

Methods

 `I`(*args, **kwds) Rotate the given vector or direction using the inverse matrix. `__call__`(*args, **kwds) Use the rotator to rotate either spherical coordinates (theta, phi) or a vector (x,y,z). `angle_ref`(*args, **kwds) Compute the angle between transverse reference direction of initial and final frames `do_rot`(i) Returns True if rotation is not (close to) identity. `get_inverse`()