# Path: condor/utils/log.py
# def log(logger, message, lvl, exception=None, rollback=1):
# def log_execution_time(logger):
#     def st_time(func):
#         def st_func(*args, **keyArgs):


import sys, numpy, types, pickle, time, math
import logging
import condor.utils.linalg
from .log import log_and_raise_error,log_warning,log_info,log_debug
            log_and_raise_error(logger, "%s is not a valid axis" % ax)
            return
    return R

def rotmx_from_quat(q):
    r"""
    Create a rotation matrix from given quaternion ([Shoemake1992]_ page 128)

    Args:
       :quaternion (array): :math:`q = w + ix + jy + kz` (``values``: :math:`[w,x,y,z]`)

    The direction of rotation follows the right hand rule
    """
    w,x,y,z = q
    R = numpy.array([[1.-2.*(y**2+z**2),
                      2.*(x*y-w*z),
                      2.*(x*z+w*y)],
                     [2.*(x*y+w*z),
                      1.-2.*(x**2+z**2),
                      2.*(y*z-w*x)],
                     [2.*(x*z-w*y),
                      2.*(y*z+w*x),
                      1.-2.*(x**2+y**2)]])
    return R



# Quaternion from rotation matrix
def quat_from_rotmx(R):
    r"""

# Path: condor/utils/log.py
# def log(logger, message, lvl, exception=None, rollback=1):
# def log_execution_time(logger):
#     def st_time(func):
#         def st_func(*args, **keyArgs):


# Path: condor/utils/rotation.py
import sys, numpy, types, pickle, time, math
import logging
import condor.utils.linalg
from .log import log_and_raise_error,log_warning,log_info,log_debug

            log_and_raise_error(logger, "%s is not a valid axis" % ax)
            return
    return R

def rotmx_from_quat(q):
    r"""
    Create a rotation matrix from given quaternion ([Shoemake1992]_ page 128)

    Args:
       :quaternion (array): :math:`q = w + ix + jy + kz` (``values``: :math:`[w,x,y,z]`)

    The direction of rotation follows the right hand rule
    """
    w,x,y,z = q
    R = numpy.array([[1.-2.*(y**2+z**2),
                      2.*(x*y-w*z),
                      2.*(x*z+w*y)],
                     [2.*(x*y+w*z),
                      1.-2.*(x**2+z**2),
                      2.*(y*z-w*x)],
                     [2.*(x*z-w*y),
                      2.*(y*z+w*x),
                      1.-2.*(x**2+y**2)]])
    return R



# Quaternion from rotation matrix
def quat_from_rotmx(R):
    r"""

    Obtain the quaternion from a given rotation matrix (ref. [euclidianspace_mxToQuat]_)