from_matrix#

classmethod Quaternion.from_matrix(matrix: ndarray | tuple | list) Quaternion[source]#

Create unit quaternions from orientation matrices [Rowenhorst et al., 2015].

Parameters:
matrix

Sequence of orientation matrices with the last two dimensions of shape (3, 3).

Returns:
Q

Unit quaternions.

Examples

>>> from orix.quaternion import Quaternion
>>> Q = Quaternion.from_matrix([np.eye(3), 2 * np.eye(3), np.diag([1, -1, -1])])
>>> Q
Quaternion (3,)
[[1. 0. 0. 0.]
 [1. 0. 0. 0.]
 [0. 1. 0. 0.]]