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:
- rotNone or sequence
Describe the rotation by its euler angle. See
euler_matrix_new()
.- coordNone or sequence of str
Describe the coordinate system transform. If rot is also given, the coordinate transform is applied first, and then the rotation.
- invbool
If True, the inverse rotation is defined. (Default: False)
- degbool
If True, angles are assumed to be in degree. (Default: True)
- eulertypestr
The Euler angle convention used. See
euler_matrix_new()
.
- 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.
rotate_alm
(alm[, lmax, mmax, inplace])Rotate Alms with the transform defined in the Rotator object
rotate_map_alms
(m[, use_pixel_weights, ...])Rotate a HEALPix map to a new reference frame in spherical harmonics space
Rotate a HEALPix map to a new reference frame in pixel space
get_inverse
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.66742347999 >>> print(phi_ecl) -1.6259571125 >>> theta_ecl, phi_ecl = Rotator(coord='ge')(theta_gal, phi_gal) # In one line >>> print(theta_ecl) 1.66742347999 >>> print(phi_ecl) -1.6259571125 >>> vec_gal = np.array([1, 0, 0]) #Using vectors >>> vec_ecl = r(vec_gal) >>> print(vec_ecl) [-0.05487563 -0.99382135 -0.09647686]