rotation_matrix#

astropy.coordinates.rotation_matrix(angle, axis='z', unit=None)[source]#

Generate matrices for rotation by some angle around some axis.

Parameters:
angleastropy:angle-like

The amount of rotation the matrices should represent. Can be an array.

axispython:str or numpy:array_like

Either 'x', 'y', 'z', or a (x,y,z) specifying the axis to rotate about. If 'x', 'y', or 'z', the rotation sense is counterclockwise looking down the + axis (e.g. positive rotations obey left-hand-rule). If given as an array, the last dimension should be 3; it will be broadcast against angle.

unitastropy:unit-like, optional

If angle does not have associated units, they are in this unit. If neither are provided, it is assumed to be degrees.

Returns:
rmatnumpy.matrix

A unitary rotation matrix.