Quaternions#

This module provides auxiliary functions for operations on unit quaternions. Each quaternion is represented by a numpy array with four elements, \((w, x, y, z)\), where \(w\) is the scalar (real) part and \((x, y, z)\) is the vector (imaginary) part. All functions can operate on arrays of quaternions.

This is an auxiliary module. Hence, the functions are not imported into the main name space of RotationalDiffusion. To access them, we recommend importing this module as follows:

>>> from RotationalDiffusion import quaternions as qops

Functions#

conjugate(quats)

Complex conjugation of quaternions.

rotmat2quat(rotmats)

Convert 3D rotation matrices to their quaternion representation.

quat2rotmat(quats)

Convert unit quaternions to their rotational matrix representation.

limit_angle(quats)

Limit the rotation angle to the interval \([0, \pi]\).

multiply(q1, q2)

Compute the Hamilton product (of arrays) of quaternions \(q_1\) and \(q_2\).