(coord)
return psi, theta, phi
Return the ZYZ Euler angles corresponding to a rotation between
    the two coordinate systems.  The angles can be used in rotate_alm.

    Parameters
    ----------
    coord : a tuple with initial and final coord systems.
      See normalise_coord.

    Returns
    -------
    psi, theta, phi :  floats
       The Euler angles defining a ZYZ rotation between the coordinate
        systems.

    Examples
    --------
    >>> np.array(coordsys2euler_zyz('GE'))
    array([ 1.4593747 ,  1.05048844, -3.14118737])
    >>> np.array(coordsys2euler_zyz('CG'))
    array([-0.22444029,  1.09731902,  2.14556673])
    >>> np.array(coordsys2euler_zyz('E'))
    array([ 0.,  0.,  0.])
Return the ZYZ Euler angles corresponding to a rotation between
    the two coordinate systems.  The angles can be used in rotate_alm.
Return the ZYZ Euler angles corresponding to a rotation between the two coordinate systems . The angles can be used in rotate_alm .
def coordsys2euler_zyz(coord):
    """Return the ZYZ Euler angles corresponding to a rotation between
    the two coordinate systems.  The angles can be used in rotate_alm.

    Parameters
    ----------
    coord : a tuple with initial and final coord systems.
      See normalise_coord.

    Returns
    -------
    psi, theta, phi :  floats
       The Euler angles defining a ZYZ rotation between the coordinate
        systems.

    Examples
    --------
    >>> np.array(coordsys2euler_zyz('GE'))
    array([ 1.4593747 ,  1.05048844, -3.14118737])
    >>> np.array(coordsys2euler_zyz('CG'))
    array([-0.22444029,  1.09731902,  2.14556673])
    >>> np.array(coordsys2euler_zyz('E'))
    array([ 0.,  0.,  0.])
    """

    coord_norm = normalise_coord(coord)

    if coord_norm[0] == coord_norm[1]:
        psi, theta, phi = np.zeros(3)
    else:
        # Convert basis vectors

        xin, yin, zin = np.eye(3)
        rot = Rotator(coord=coord_norm)
        xout, yout, zout = rot([xin, yin, zin]).T

        # Normalize

        xout /= np.sqrt(np.dot(xout, xout))
        yout /= np.sqrt(np.dot(yout, yout))
        zout /= np.sqrt(np.dot(zout, zout))

        # Get the angles

        psi = np.arctan2(yout[2], -xout[2])
        theta = np.arccos(np.dot(zin, zout))
        phi = np.arctan2(zout[1], zout[0])

    return psi, theta, phi
def coordsys2euler_zyz ( coord ) : coord_norm = normalise_coord ( coord ) if coord_norm [ 0 ] == coord_norm [ 1 ] : psi , theta , phi = np . zeros ( 3 ) else : # Convert basis vectors xin , yin , zin = np . eye ( 3 ) rot = Rotator ( coord = coord_norm ) xout , yout , zout = rot ( [ xin , yin , zin ] ) . T # Normalize xout /= np . sqrt ( np . dot ( xout , xout ) ) yout /= np . sqrt ( np . dot ( yout , yout ) ) zout /= np . sqrt ( np . dot ( zout , zout ) ) # Get the angles psi = np . arctan2 ( yout [ 2 ] , - xout [ 2 ] ) theta = np . arccos ( np . dot ( zin , zout ) ) phi = np . arctan2 ( zout [ 1 ] , zout [ 0 ] ) return psi , theta , phi