euler

Conversion functions for the internal nexus coordinate system to Euler angles in ZYZ convention. The module is helpful to convert certain EFG directions to the proper Euler angles.

Nexus works with extrinsic ZYZ convention for the Euler angles. All rotations take place around the fixed frame coordinate system of Nexus. In extrinsic ZYZ convention the first angle alpha, is only needed to set the asymmetry, in contrast to CONUSS where it is gamma. This reflects the fact, that the meaning of alpha and gamma are inverse for extrinsic and intrinsic ZYZ convention. If you want to change to intrinsic ZYZ (like in CONUSS) interchange alpha and gamma angles.

The rotation matrix R rotates the vector v in the coordinate system to the new position \(w = R*v\).

R = R x * R y * R z is a rotation matrix that may be used to represent a composition of extrinsic rotations about axes z, y, x, (in that order) or a composition of intrinsic rotations about axes x-y′-z″ (in that order).

Conventions for ZYZ Euler angles by rotation matrices are:

  • extrinsic R ZYZ = R Z (\(\\alpha\)) * R Y (\(\\beta\)) * R Z (\(\gamma\)) all rotations around the fixed frame system in the order z, y, z

  • intrinsic R Z’’Y’Z = R Z’’ (\(\gamma\)) * R Y’ (\(\\beta\)) * R Z (\(\\alpha\)) all rotations about the rotated body system in the order Z , Y’, Z’’.

Note the changed order of angles \(\\alpha\) and \(\gamma\).

The transformation matrix T describes the transformation from the EFG system (XYZ, EFG) to the fixed frame system (xyz, [\(\sigma\), \(\pi\), k]). And thus is equal to R ZYZ.

v xyz = R ZYZ * v XYZ

= R Z (\(\\alpha\)) * R Y (\(\\beta\)) * R Z (\(\gamma\)) * v XYZ

For the transformation from the fixed frame system to the body system, the matrix relation is

v XYZ = (R ZYZ ) T * v xyz

= R Z (\(\gamma\)) T * R Y (\(\\beta\)) T * R Z (\(\\alpha\)) T * v xyz

nexus.euler.AnglesToVectors(alpha, beta, gamma)

Calculates the EFG vectors corresponding to the Euler angles in extrinsic ZYZ convention. Input the extrinsic ZYZ Euler angles to obtain Vxx, Vyy, Vzz.

Returns:

Vxx, Vyy, Vzz (row vectors)

Return type:

ndarray, ndarray, ndarray

nexus.euler.RotationX(angle)

Returns the rotation matrix for a rotation by angle around the X axis of the internal coordinate system.

Parameters:

angle (float) – rotation angle.

Returns:

3x3 rotation matrix.

Return type:

ndarray

nexus.euler.RotationY(angle)

Returns the rotation matrix for a rotation by angle around the Y axis of the internal coordinate system.

Parameters:

angle (float) – rotation angle.

Returns:

3x3 rotation matrix.

Return type:

ndarray

nexus.euler.RotationZ(angle)

Returns the rotation matrix for a rotation by angle around the Z axis of the internal coordinate system.

Parameters:

angle (float) – rotation angle.

Returns:

3x3 rotation matrix.

Return type:

ndarray

nexus.euler.TransformationMatrixToEFGvectors(T)

Returns the column vectors from the transformation matrix T. Input the transformation matrix of the EFG components from ZYZEulerToTransformationMatrix to obtain Vxx, Vyy, Vzz.

Parameters:

T (ndarray) – 3x3 transformation matrix.

Returns:

Vxx, Vyy, Vzz (row vectors)

Return type:

ndarray, ndarray, ndarray

nexus.euler.TransformationMatrixToZYZEuler(T)

Returns the Euler angles from a 3x3 transformation matrix between two coordinate systems. Calculates the Euler angles with respect to the internal coordinate system [x,y,z] = [sigma,pi,k].

Parameters:

T (ndarray) – 3x3 numpy array.

Returns:

alpha, beta, gamma

Return type:

float, float, float

nexus.euler.VectorsToAngles(Vzz, Vxx=[], Vyy=[])

Calculates the Euler angles corresponding to the EFG vectors in internal coordinate system. Input 3 orthogonal vectors of the EFG components Vxx, Vyy, and Vzz in the internal coordinate system or just the main component Vzz. The vectors will be normalized, so only their directions is important.

e.g. Vxx = [0,0,1], Vyy = [-1,-1,0], Vzz = [1,-1,0] in the [sigma,pi,k] coordinate system.

Note

In case only the main axis Vyy is given, the returned alpha value is random.

Parameters:
  • Vxx (ndarray) – Vxx vector in the reference frame.

  • Vyy (ndarray) – Vyy vector in the reference frame.

  • Vzz (ndarray) – Vzz vector in the reference frame.

Returns:

alpha, beta, gamma

Return type:

float, float, float

nexus.euler.ZYZEulerToTransformationMatrix(alpha, beta, gamma)

Returns the 3x3 transformation matrix from extrinsic Euler angles of the EFG to rotate to internal coordinate system. Euler angles in extrinsic ZYZ convention. Same as ZYZEulerToTransformationMatrixExtrinsic(alpha, beta, gamma).

Parameters:
  • alpha (float) – Euler angle alpha

  • beta (float) – Euler angle beta

  • gamma (float) – Euler angle gamma

Returns:

3x3 transformations matrix.

Return type:

ndarray

nexus.euler.ZYZEulerToTransformationMatrixExtrinsic(alpha, beta, gamma)

Returns the 3x3 transformation matrix from extrinsic Euler angles of the EFG to rotate to internal coordinate system. Euler angles in extrinsic ZYZ convention.

Parameters:
  • alpha (float) – Euler angle alpha

  • beta (float) – Euler angle beta

  • gamma (float) – Euler angle gamma

Returns:

3x3 transformations matrix.

Return type:

ndarray

nexus.euler.ZYZEulerToTransformationMatrixIntrinsic(alpha, beta, gamma)

Returns the 3x3 transformation matrix from intrinsic Euler angles of the EFG to rotate to internal coordinate system. Euler angles in intrinsic ZYZ convention.

Parameters:
  • alpha (float) – Euler angle alpha

  • beta (float) – Euler angle beta

  • gamma (float) – Euler angle gamma

Returns:

3x3 transformations matrix.

Return type:

ndarray