Module Expr Str Import alias Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareNotEq Call NameLoad NameLoad Num body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body TryExcept body Assign NameStore BinOpMult UnaryOpUSub AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr Num handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore BinOpMult UnaryOpUSub NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore BinOpSub Num Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareLt NameLoad Num body If CompareLt NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore Num orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore NameLoad Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad If CompareLt NameLoad NameLoad body Return Call AttributeLoad NameLoad attr Num Assign NameStore BinOpDiv Num NameLoad Assign NameStore BinOpMult NameLoad NameLoad Assign NameStore BinOpMult NameLoad NameLoad Assign NameStore BinOpMult NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Return Call AttributeLoad NameLoad attr ListLoad ListLoad BinOpSub Num BinOpAdd NameLoad NameLoad BinOpSub NameLoad NameLoad BinOpAdd NameLoad NameLoad ListLoad BinOpAdd NameLoad NameLoad BinOpSub Num BinOpAdd NameLoad NameLoad BinOpSub NameLoad NameLoad ListLoad BinOpSub NameLoad NameLoad BinOpAdd NameLoad NameLoad BinOpSub Num BinOpAdd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr ListLoad ListLoad BinOpSub BinOpSub NameLoad NameLoad NameLoad Num Num Num ListLoad BinOpAdd NameLoad NameLoad BinOpSub BinOpSub NameLoad NameLoad NameLoad Num Num ListLoad BinOpAdd NameLoad NameLoad BinOpAdd NameLoad NameLoad BinOpSub BinOpSub NameLoad NameLoad NameLoad Num ListLoad BinOpSub NameLoad NameLoad BinOpSub NameLoad NameLoad BinOpSub NameLoad NameLoad BinOpAdd BinOpAdd NameLoad NameLoad NameLoad Num Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore SubscriptLoad NameLoad Index TupleLoad ListLoad Num Num Num Num Call AttributeLoad NameLoad attr NameLoad If CompareLt SubscriptLoad NameLoad Index Num Num body AugAssignMult NameStore Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore NameLoad Assign TupleStore NameStore NameStore NameStore NameStore NameLoad Assign NameStore BinOpSub BinOpSub BinOpSub BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Return Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpMult Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr ListLoad Num Num Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpDiv Call NameLoad NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Return Call AttributeLoad NameLoad attr ListLoad Num Num Num Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Num Assign SubscriptStore NameLoad Slice Num NameLoad Return SubscriptLoad Call NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Slice Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num Num body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad body Return NameLoad Return Call AttributeLoad NameLoad attr BinOpMult NameLoad Num NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign NameStore BinOpDiv NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpDiv NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr TupleLoad ListLoad Call AttributeLoad NameLoad attr NameLoad BinOpMult NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore BinOpDiv NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpSub Num NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Return Call AttributeLoad NameLoad attr ListLoad ListLoad BinOpAdd BinOpMult NameLoad NameLoad NameLoad BinOpSub NameLoad NameLoad BinOpAdd NameLoad NameLoad ListLoad BinOpAdd NameLoad NameLoad BinOpAdd BinOpMult NameLoad NameLoad NameLoad BinOpSub NameLoad NameLoad ListLoad BinOpSub NameLoad NameLoad BinOpAdd NameLoad NameLoad BinOpAdd BinOpMult NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad NameLoad If CompareIs NameLoad NameLoad body TryExcept body Assign NameStore BinOpMult AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr Num handlers ExceptHandler type NameLoad body Assign NameStore BinOpMult NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad If CompareLt NameLoad NameLoad body Return TupleLoad Num Call AttributeLoad NameLoad attr ListLoad Num Num Num Return TupleLoad BinOpMult Num Call AttributeLoad NameLoad attr NameLoad BinOpDiv NameLoad NameLoad decorator_list
N/A N/A 
Functions to operate on, or return, quaternions.

The module also includes functions for the closely related angle, axis
pair as a specification for rotation.

Quaternions here consist of 4 values ``w, x, y, z``, where ``w`` is the
real (scalar) part, and ``x, y, z`` are the complex (vector) part.

Note - rotation matrices here apply to column vectors, that is,
they are applied on the left of the vector.  For example:

>>> import numpy as np
>>> q = [0, 1, 0, 0] # 180 degree rotation around axis 0
>>> M = quat2mat(q) # from this module
>>> vec = np.array([1, 2, 3]).reshape((3,1)) # column vector
>>> tvec = np.dot(M, vec)
 N/A math N/A numpy np N/A MAX_FLOAT N/A N/A np maximum_sctype N/A np float N/A FLOAT_EPS N/A N/A N/A np finfo N/A np float eps fillpositive N/A N/A xyz w2_thresh N/A None N/A N/A  Compute unit quaternion from last 3 values

    Parameters
    ----------
    xyz : iterable
       iterable containing 3 values, corresponding to quaternion x, y, z
    w2_thresh : None or float, optional
       threshold to determine if w squared is really negative.
       If None (default) then w2_thresh set equal to
       ``-np.finfo(xyz.dtype).eps``, if possible, otherwise
       ``-np.finfo(np.float).eps``

    Returns
    -------
    wxyz : array shape (4,)
         Full 4 values of quaternion

    Notes
    -----
    If w, x, y, z are the values in the full quaternion, assumes w is
    positive.

    Gives error if w*w is estimated to be negative

    w = 0 corresponds to a 180 degree rotation

    The unit quaternion specifies that np.dot(wxyz, wxyz) == 1.

    If w is positive (assumed here), w is given by:

    w = np.sqrt(1.0-(x*x+y*y+z*z))

    w2 = 1.0-(x*x+y*y+z*z) can be near zero, which will lead to
    numerical instability in sqrt.  Here we use the system maximum
    float type to reduce numerical instability

    Examples
    --------
    >>> import numpy as np
    >>> wxyz = fillpositive([0,0,0])
    >>> np.all(wxyz == [1, 0, 0, 0])
    True
    >>> wxyz = fillpositive([1,0,0]) # Corner case; w is 0
    >>> np.all(wxyz == [0, 1, 0, 0])
    True
    >>> np.dot(wxyz, wxyz)
    1.0
     N/A N/A N/A len xyz 3 N/A N/A N/A ValueError xyz should have length 3 N/A N/A w2_thresh None N/A N/A N/A N/A w2_thresh N/A N/A N/A N/A N/A np finfo N/A xyz dtype eps 3 N/A N/A N/A N/A AttributeError ValueError N/A N/A w2_thresh N/A N/A FLOAT_EPS 3 N/A xyz N/A N/A np asarray xyz dtype MAX_FLOAT N/A w2 N/A 1.0 N/A N/A np dot xyz xyz N/A N/A w2 0 N/A N/A N/A w2 w2_thresh N/A N/A N/A ValueError N/A w2 should be positive, but is %e w2 N/A w 0 N/A N/A w N/A N/A np sqrt w2 N/A N/A N/A np r_ N/A N/A w xyz N/A quat2mat N/A N/A q N/A N/A N/A  Calculate rotation matrix corresponding to quaternion

    Parameters
    ----------
    q : 4 element array-like

    Returns
    -------
    M : (3,3) array
      Rotation matrix corresponding to input quaternion *q*

    Notes
    -----
    Rotation matrix applies to column vectors, and is applied to the
    left of coordinate vectors.  The algorithm here allows non-unit
    quaternions.

    References
    ----------
    Algorithm from
    https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion

    Examples
    --------
    >>> import numpy as np
    >>> M = quat2mat([1, 0, 0, 0]) # Identity quaternion
    >>> np.allclose(M, np.eye(3))
    True
    >>> M = quat2mat([0, 1, 0, 0]) # 180 degree rotn around axis 0
    >>> np.allclose(M, np.diag([1, -1, -1]))
    True
     N/A N/A w x y z q N/A Nq N/A N/A N/A N/A w w N/A x x N/A y y N/A z z N/A N/A Nq FLOAT_EPS N/A N/A N/A N/A np eye 3 N/A s N/A 2.0 Nq N/A X N/A x s N/A Y N/A y s N/A Z N/A z s N/A N/A wX wY wZ N/A N/A w X N/A w Y N/A w Z N/A N/A xX xY xZ N/A N/A x X N/A x Y N/A x Z N/A N/A yY yZ zZ N/A N/A y Y N/A y Z N/A z Z N/A N/A N/A np array N/A N/A N/A 1.0 N/A yY zZ N/A xY wZ N/A xZ wY N/A N/A xY wZ N/A 1.0 N/A xX zZ N/A yZ wX N/A N/A xZ wY N/A yZ wX N/A 1.0 N/A xX yY N/A mat2quat N/A N/A M N/A N/A N/A  Calculate quaternion corresponding to given rotation matrix

    Parameters
    ----------
    M : array-like
      3x3 rotation matrix

    Returns
    -------
    q : (4,) array
      closest quaternion to input matrix, having positive q[0]

    Notes
    -----
    Method claimed to be robust to numerical errors in M

    Constructs quaternion by calculating maximum eigenvector for matrix
    K (constructed from input `M`).  Although this is not tested, a
    maximum eigenvalue of 1 corresponds to a valid rotation.

    A quaternion q*-1 corresponds to the same rotation as q; thus the
    sign of the reconstructed quaternion is arbitrary, and we return
    quaternions with positive w (q[0]).

    References
    ----------
    * https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion
    * Bar-Itzhack, Itzhack Y. (2000), "New method for extracting the
      quaternion from a rotation matrix", AIAA Journal of Guidance,
      Control and Dynamics 23(6):1085-1087 (Engineering Note), ISSN
      0731-5090

    Examples
    --------
    >>> import numpy as np
    >>> q = mat2quat(np.eye(3)) # Identity rotation
    >>> np.allclose(q, [1, 0, 0, 0])
    True
    >>> q = mat2quat(np.diag([1, -1, -1]))
    >>> np.allclose(q, [0, 1, 0, 0]) # 180 degree rotn around axis 0
    True

     N/A N/A Qxx Qyx Qzx Qxy Qyy Qzy Qxz Qyz Qzz N/A M flat N/A K N/A N/A N/A np array N/A N/A N/A N/A Qxx Qyy Qzz 0 0 0 N/A N/A Qyx Qxy N/A N/A Qyy Qxx Qzz 0 0 N/A N/A Qzx Qxz N/A Qzy Qyz N/A N/A Qzz Qxx Qyy 0 N/A N/A Qyz Qzy N/A Qzx Qxz N/A Qxy Qyx N/A N/A Qxx Qyy Qzz 3.0 N/A N/A vals vecs N/A N/A N/A np linalg eigh K N/A q N/A vecs N/A N/A N/A 3 0 1 2 N/A N/A np argmax vals N/A N/A N/A q N/A 0 0 N/A N/A q -1 N/A q N/A mult N/A N/A q1 q2 N/A N/A N/A  Multiply two quaternions

    Parameters
    ----------
    q1 : 4 element sequence
    q2 : 4 element sequence

    Returns
    -------
    q12 : shape (4,) array

    Notes
    -----
    See : https://en.wikipedia.org/wiki/Quaternions#Hamilton_product
     N/A N/A w1 x1 y1 z1 q1 N/A N/A w2 x2 y2 z2 q2 N/A w N/A N/A N/A N/A w1 w2 N/A x1 x2 N/A y1 y2 N/A z1 z2 N/A x N/A N/A N/A N/A w1 x2 N/A x1 w2 N/A y1 z2 N/A z1 y2 N/A y N/A N/A N/A N/A w1 y2 N/A y1 w2 N/A z1 x2 N/A x1 z2 N/A z N/A N/A N/A N/A w1 z2 N/A z1 w2 N/A x1 y2 N/A y1 x2 N/A N/A N/A np array N/A w x y z N/A conjugate N/A N/A q N/A N/A N/A  Conjugate of quaternion

    Parameters
    ----------
    q : 4 element sequence
       w, i, j, k of quaternion

    Returns
    -------
    conjq : array shape (4,)
       w, i, j, k of conjugate of `q`
     N/A N/A N/A N/A np array q N/A N/A np array N/A 1.0 -1 -1 -1 N/A norm N/A N/A q N/A N/A N/A  Return norm of quaternion

    Parameters
    ----------
    q : 4 element sequence
       w, i, j, k of quaternion

    Returns
    -------
    n : scalar
       quaternion norm
     N/A N/A N/A np dot q q N/A isunit N/A N/A q N/A N/A N/A  Return True is this is very nearly a unit quaternion  N/A N/A N/A np allclose N/A norm q 1 N/A inverse N/A N/A q N/A N/A N/A  Return multiplicative inverse of quaternion `q`

    Parameters
    ----------
    q : 4 element sequence
       w, i, j, k of quaternion

    Returns
    -------
    invq : array shape (4,)
       w, i, j, k of quaternion inverse
     N/A N/A N/A conjugate q N/A norm q N/A eye N/A N/A N/A N/A N/A  Return identity quaternion  N/A N/A N/A np array N/A 1.0 0 0 0 N/A rotate_vector N/A N/A v q N/A N/A N/A  Apply transformation in quaternion `q` to vector `v`

    Parameters
    ----------
    v : 3 element sequence
       3 dimensional vector
    q : 4 element sequence
       w, i, j, k of quaternion

    Returns
    -------
    vdash : array shape (3,)
       `v` rotated by quaternion `q`

    Notes
    -----
    See:
    https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Describing_rotations_with_quaternions

     N/A varr N/A N/A np zeros N/A 4 N/A N/A varr N/A 1 v N/A N/A N/A mult q N/A mult varr N/A conjugate q N/A 1 N/A nearly_equivalent N/A N/A q1 q2 rtol atol N/A 1e-05 1e-08 N/A N/A  Returns True if `q1` and `q2` give near equivalent transforms

    `q1` may be nearly numerically equal to `q2`, or nearly equal to `q2` * -1
    (because a quaternion multiplied by -1 gives the same transform).

    Parameters
    ----------
    q1 : 4 element sequence
       w, x, y, z of first quaternion
    q2 : 4 element sequence
       w, x, y, z of second quaternion

    Returns
    -------
    equiv : bool
       True if `q1` and `q2` are nearly equivalent, False otherwise

    Examples
    --------
    >>> q1 = [1, 0, 0, 0]
    >>> nearly_equivalent(q1, [0, 1, 0, 0])
    False
    >>> nearly_equivalent(q1, [1, 0, 0, 0])
    True
    >>> nearly_equivalent(q1, [-1, 0, 0, 0])
    True
     N/A q1 N/A N/A np array q1 N/A q2 N/A N/A np array q2 N/A N/A N/A np allclose q1 q2 rtol atol N/A N/A True N/A N/A N/A np allclose N/A q1 -1 q2 rtol atol N/A angle_axis2quat N/A N/A theta vector is_normalized N/A False N/A N/A  Quaternion for rotation of angle `theta` around `vector`

    Parameters
    ----------
    theta : scalar
       angle of rotation
    vector : 3 element sequence
       vector specifying axis for rotation.
    is_normalized : bool, optional
       True if vector is already normalized (has norm of 1).  Default
       False

    Returns
    -------
    quat : 4 element sequence of symbols
       quaternion giving specified rotation

    Examples
    --------
    >>> q = angle_axis2quat(np.pi, [1, 0, 0])
    >>> np.allclose(q, [0, 1, 0,  0])
    True

    Notes
    -----
    Formula from http://mathworld.wolfram.com/EulerParameters.html
     N/A vector N/A N/A np array vector N/A N/A is_normalized N/A N/A vector N/A vector N/A N/A math sqrt N/A N/A np dot vector vector N/A t2 N/A theta 2.0 N/A st2 N/A N/A math sin t2 N/A N/A N/A np concatenate N/A N/A N/A N/A math cos t2 N/A vector st2 N/A angle_axis2mat N/A N/A theta vector is_normalized N/A False N/A N/A  Rotation matrix of angle `theta` around `vector`

    Parameters
    ----------
    theta : scalar
       angle of rotation
    vector : 3 element sequence
       vector specifying axis for rotation.
    is_normalized : bool, optional
       True if vector is already normalized (has norm of 1).  Default
       False

    Returns
    -------
    mat : array shape (3,3)
       rotation matrix for specified rotation

    Notes
    -----
    From: https://en.wikipedia.org/wiki/Rotation_matrix#Axis_and_angle
     N/A N/A x y z vector N/A N/A is_normalized N/A N/A n N/A N/A math sqrt N/A N/A N/A x x N/A y y N/A z z N/A x N/A x n N/A y N/A y n N/A z N/A z n N/A N/A c s N/A N/A N/A math cos theta N/A N/A math sin theta N/A C N/A 1 c N/A N/A xs ys zs N/A N/A x s N/A y s N/A z s N/A N/A xC yC zC N/A N/A x C N/A y C N/A z C N/A N/A xyC yzC zxC N/A N/A x yC N/A y zC N/A z xC N/A N/A N/A np array N/A N/A N/A N/A x xC c N/A xyC zs N/A zxC ys N/A N/A xyC zs N/A N/A y yC c N/A yzC xs N/A N/A zxC ys N/A yzC xs N/A N/A z zC c N/A quat2angle_axis N/A N/A quat identity_thresh N/A None N/A N/A  Convert quaternion to rotation of angle around axis

    Parameters
    ----------
    quat : 4 element sequence
       w, x, y, z forming quaternion
    identity_thresh : None or scalar, optional
       threshold below which the norm of the vector part of the
       quaternion (x, y, z) is deemed to be 0, leading to the identity
       rotation.  None (the default) leads to a threshold estimated
       based on the precision of the input.

    Returns
    -------
    theta : scalar
       angle of rotation
    vector : array shape (3,)
       axis around which rotation occurs

    Examples
    --------
    >>> theta, vec = quat2angle_axis([0, 1, 0, 0])
    >>> np.allclose(theta, np.pi)
    True
    >>> vec
    array([ 1.,  0.,  0.])

    If this is an identity rotation, we return a zero angle and an
    arbitrary vector

    >>> quat2angle_axis([1, 0, 0, 0])
    (0.0, array([ 1.,  0.,  0.]))

    Notes
    -----
    A quaternion for which x, y, z are all equal to 0, is an identity
    rotation.  In this case we return a 0 angle and an  arbitrary
    vector, here [1, 0, 0]
     N/A N/A w x y z quat N/A vec N/A N/A np asarray N/A x y z N/A N/A identity_thresh None N/A N/A N/A N/A identity_thresh N/A N/A N/A N/A np finfo N/A vec dtype eps 3 N/A N/A N/A ValueError N/A N/A identity_thresh N/A FLOAT_EPS 3 N/A n N/A N/A math sqrt N/A N/A N/A x x N/A y y N/A z z N/A N/A n identity_thresh N/A N/A N/A 0.0 N/A N/A np array N/A 1.0 0 0 N/A N/A N/A 2 N/A N/A math acos w N/A vec n N/A