is_identity#

ahrs.common.quaternion.QuaternionArray.is_identity(self) ndarray#

Returns an array of boolean values, where a value is True if its quaternion is equal to the identity quaternion.

An identity quaternion has its scalar part equal to 1, and its vector part equal to 0, such that \(\mathbf{q} = 1 + 0i + 0j + 0k\).

\[\begin{split}\left\{ \begin{array}{ll} \mathrm{True} & \: \mathbf{q}\ = \begin{pmatrix} 1 & 0 & 0 & 0 \end{pmatrix} \\ \mathrm{False} & \: \mathrm{otherwise} \end{array} \right.\end{split}\]
Returns:

out – Array of booleans.

Return type:

np.ndarray

Example

>>> Q = QuaternionArray(np.random.random((3, 4))-0.5)
>>> Q[1] = [1.0, 0.0, 0.0, 0.0]
>>> Q.view()
QuaternionArray([[-0.8061095 ,  0.42513151,  0.37790158, -0.16322091],
                 [ 1.        ,  0.        ,  0.        ,  0.        ],
                 [ 0.29613776,  0.21692562, -0.16253866, -0.91587493]])
>>> Q.is_identity()
array([False,  True, False])