API reference

euler2matrix

eulerangles.euler2matrix(euler_angles: numpy.ndarray, axes: str, intrinsic: bool, right_handed_rotation: bool) numpy.ndarray

Derive rotation matrices from a set of euler angles.

Parameters
euler_angles(n, 3) or (3,) array

euler angles (in degrees)

axesstr

valid sequence of three non-sequential axes from ‘x’, ‘y’ and ‘z’ e.g. ‘zyz’, ‘zxz’, ‘xyz’

intrinsicbool

True - Euler angles are interpreted as intrinsic rotations False - Euler angles are interpreted as extrinsic rotations

right_handed_rotationbool

True - Euler angles are interpreted as right handed rotations False - Euler angles are interpreted as left handed rotations

Returns
rotation_matrices(n, 3, 3) or (3, 3) array

rotation matrices derived from euler angles.

matrix2euler

eulerangles.matrix2euler(rotation_matrices: numpy.ndarray, axes: str, intrinsic: bool, right_handed_rotation: bool) numpy.ndarray

Derive a set of euler angles from a set of rotation matrices.

Parameters
rotation_matrices(n, 3, 3) or (3, 3) array of float

rotation matrices from which euler angles are derived

axesstr

valid sequence of three non-sequential axes from ‘x’, ‘y’ and ‘z’ e.g. ‘zyz’, ‘zxz’, ‘xyz’

intrinsicbool

True - Euler angles are for intrinsic rotations False - Euler angles are for extrinsic rotations

right_handed_rotationbool

True - Euler angles are for right handed rotations False - Euler angles are for left handed rotations

Returns
euler_angles(n, 3) or (3,) array

Euler angles derived from rotation matrices

euler2euler

eulerangles.euler2euler(euler_angles: numpy.ndarray, source_axes: str, source_right_handed_rotation: bool, source_intrinsic: bool, target_axes: str, target_right_handed_rotation: bool, target_intrinsic: bool, invert_matrix: bool)

Convert a set of Euler angles defined one way into a set of Euler angles defined another way.

Parameters
euler_angles(n, 3) or (3,) array

Euler angles to convert

source_axesstr

valid sequence of three non-sequential axes from ‘x’, ‘y’ and ‘z’

source_right_handed_rotationbool

True - Euler angles are interpreted as right handed rotations False - Euler angles are interpreted as left handed rotations

source_intrinsicbool

True - Euler angles are interpreted as intrinsic rotations False - Euler angles are interpreted as extrinsic rotations

target_axesstr

valid sequence of three non-sequential axes from ‘x’, ‘y’ and ‘z’

target_right_handed_rotationbool

True - Euler angles are interpreted as right handed rotations False - Euler angles are interpreted as left handed rotations

target_intrinsicbool

True - Euler angles are interpreted as intrinsic rotations False - Euler angles are interpreted as extrinsic rotations

invert_matrixbool

True - rotation matrices will be inverted prior to deriving new Euler angles False - rotation matrices will not be inverted prior to deriving new Euler angles

Returns
euler_angles(n, 3) or (3,) array

Euler angles generated from input Euler angles

convert_eulers

eulerangles.convert_eulers(euler_angles: numpy.ndarray, source_meta: Union[eulerangles.base.ConversionMeta, str], target_meta: Union[eulerangles.base.ConversionMeta, str])

Convert Euler angles defined according to one ‘convention’ into Euler angles defined according to another.

Parameters
euler_angles(n, 3) or (3,) array of float

Euler angles to be converted

source_metaConversionMeta or str

metadata defining how to interpret the euler angles or a string with the name of a software package

target_metaConversionMeta or str

metadata defining how to generate euler angles or a string with the name of a software package

Returns
euler_angles(n, 3) or (3,) array of float

Euler angles resulting from conversion

invert_rotation_matrices

eulerangles.invert_rotation_matrices(rotation_matrices: numpy.ndarray)

Invert rotation matrices by transposing the last two axes

ConversionMeta

class eulerangles.ConversionMeta(name: str, axes: str, intrinsic: bool, right_handed_rotation: bool, active: bool)

A simple object holding metadata explaining how to interpret Euler angles in the context of density reconstruction from transmission electron microscopy data.

name: str

the name of the software package

axes: str

a valid non-sequential sequence of axes e.g. ‘zxz’, ‘yxz’

intrinsic: bool

True - the euler angles represent intrinsic rotations, the coordinate system moves with the rotating rigid body False - the euler angles represent extrinsic rotations, the rigid body rotates with respect to a fixed coordinate system

right_handed_rotation: bool

True - the euler angles represent right handed rotations in a right handed coordinate system False - the euler angles represent left handed rotations in a right handed coordinate system

active: bool

True - the transformation is an active transformation False - the transformation is a passive transformation this property is only used during comparison of ConversionMeta objects when deciding whether or not to invert rotation matrices during euler angle conversion.