# Path: sensbiotk/transforms3d/quaternions.py
# MAX_FLOAT = np.maximum_sctype(np.float)
# FLOAT_EPS = np.finfo(np.float).eps
#     X = x*s
#     Y = y*s
#     Z = z*s
#     K = np.array([
#         [Qxx - Qyy - Qzz, 0,               0,               0              ],
#         [Qyx + Qxy,       Qyy - Qxx - Qzz, 0,               0              ],
#         [Qzx + Qxz,       Qzy + Qyz,       Qzz - Qxx - Qyy, 0              ],
#         [Qyz - Qzy,       Qzx - Qxz,       Qxy - Qyx,       Qxx + Qyy + Qzz]]
#         ) / 3.0
#     c = math.cos(theta); s = math.sin(theta); C = 1-c
# def fillpositive(xyz, w2_thresh=None):
# def quat2mat(q):
# def mat2quat(M):
# def mult(q1, q2):
# def conjugate(q):
# def norm(q):
# def norm2(q):
# def normalize(q):
# def isunit(q):
# def inverse(q):
# def eye():
# def rotate_vector(v, q):
# def nearly_equivalent(q1, q2, rtol=1e-5, atol=1e-8):
# def angle_axis2quat(theta, vector, is_normalized=False):
# def angle_axis2mat(theta, vector, is_normalized=False):
# def quat2angle_axis(quat, identity_thresh=None):
# 
# Path: sensbiotk/transforms3d/eulerangles.py
# _FLOAT_EPS_4 = np.finfo(float).eps * 4.0
#     M = np.asarray(M)
#     M = nq.angle_axis2mat(theta, vector, is_normalized)
# def euler2mat(z=0, y=0, x=0):
# def mat2euler(M, cy_thresh=None):
# def euler2quat(z=0, y=0, x=0):
# def euler2quat2(yaw=0, pitch=0, roll=0):
# def quat2euler(q):
# def quat2euler2(q):
# def quat2euler3(q):
# def quat2euler4(q):
# def quat2euler5(q):
# def euler2angle_axis(z=0, y=0, x=0):
# def angle_axis2euler(theta, vector, is_normalized=False):


import numpy as np
from numpy import pi
    from numpy.testing.decorators import slow
from nose.tools import assert_raises, assert_true, assert_false, \
    assert_equal
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sensbiotk.transforms3d import quaternions as nq
from sensbiotk.transforms3d import eulerangles as nea
    yield assert_true, wxyz[0] == 0.0


def test_conjugate():
    # Takes sequence
    cq = nq.conjugate((1, 0, 0, 0))
    # Returns float type
    yield assert_true, cq.dtype.kind == 'f'


def test_quat2mat():
    # also tested in roundtrip case below
    M = nq.quat2mat([1, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    M = nq.quat2mat([3, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    M = nq.quat2mat([0, 1, 0, 0])
    yield assert_array_almost_equal, M, np.diag([1, -1, -1])
    M = nq.quat2mat([0, 2, 0, 0])
    yield assert_array_almost_equal, M, np.diag([1, -1, -1])
    M = nq.quat2mat([0, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    

def test_inverse():
    # Takes sequence
    iq = nq.inverse((1, 0, 0, 0))
    # Returns float type
    yield assert_true, iq.dtype.kind == 'f'
    for M, q in eg_pairs:

# Path: sensbiotk/transforms3d/quaternions.py
# MAX_FLOAT = np.maximum_sctype(np.float)
# FLOAT_EPS = np.finfo(np.float).eps
#     X = x*s
#     Y = y*s
#     Z = z*s
#     K = np.array([
#         [Qxx - Qyy - Qzz, 0,               0,               0              ],
#         [Qyx + Qxy,       Qyy - Qxx - Qzz, 0,               0              ],
#         [Qzx + Qxz,       Qzy + Qyz,       Qzz - Qxx - Qyy, 0              ],
#         [Qyz - Qzy,       Qzx - Qxz,       Qxy - Qyx,       Qxx + Qyy + Qzz]]
#         ) / 3.0
#     c = math.cos(theta); s = math.sin(theta); C = 1-c
# def fillpositive(xyz, w2_thresh=None):
# def quat2mat(q):
# def mat2quat(M):
# def mult(q1, q2):
# def conjugate(q):
# def norm(q):
# def norm2(q):
# def normalize(q):
# def isunit(q):
# def inverse(q):
# def eye():
# def rotate_vector(v, q):
# def nearly_equivalent(q1, q2, rtol=1e-5, atol=1e-8):
# def angle_axis2quat(theta, vector, is_normalized=False):
# def angle_axis2mat(theta, vector, is_normalized=False):
# def quat2angle_axis(quat, identity_thresh=None):
# 
# Path: sensbiotk/transforms3d/eulerangles.py
# _FLOAT_EPS_4 = np.finfo(float).eps * 4.0
#     M = np.asarray(M)
#     M = nq.angle_axis2mat(theta, vector, is_normalized)
# def euler2mat(z=0, y=0, x=0):
# def mat2euler(M, cy_thresh=None):
# def euler2quat(z=0, y=0, x=0):
# def euler2quat2(yaw=0, pitch=0, roll=0):
# def quat2euler(q):
# def quat2euler2(q):
# def quat2euler3(q):
# def quat2euler4(q):
# def quat2euler5(q):
# def euler2angle_axis(z=0, y=0, x=0):
# def angle_axis2euler(theta, vector, is_normalized=False):


# Path: sensbiotk/tests/test_quaternions.py
import numpy as np
from numpy import pi
    from numpy.testing.decorators import slow
from nose.tools import assert_raises, assert_true, assert_false, \
    assert_equal
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sensbiotk.transforms3d import quaternions as nq
from sensbiotk.transforms3d import eulerangles as nea

    yield assert_true, wxyz[0] == 0.0


def test_conjugate():
    # Takes sequence
    cq = nq.conjugate((1, 0, 0, 0))
    # Returns float type
    yield assert_true, cq.dtype.kind == 'f'


def test_quat2mat():
    # also tested in roundtrip case below
    M = nq.quat2mat([1, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    M = nq.quat2mat([3, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    M = nq.quat2mat([0, 1, 0, 0])
    yield assert_array_almost_equal, M, np.diag([1, -1, -1])
    M = nq.quat2mat([0, 2, 0, 0])
    yield assert_array_almost_equal, M, np.diag([1, -1, -1])
    M = nq.quat2mat([0, 0, 0, 0])
    yield assert_array_almost_equal, M, np.eye(3)
    

def test_inverse():
    # Takes sequence
    iq = nq.inverse((1, 0, 0, 0))
    # Returns float type
    yield assert_true, iq.dtype.kind == 'f'
    for M, q in eg_pairs:

        iq = nq.inverse(q)