(coord)
return matconv, do_conv, coord_norm
Return the rotation matrix corresponding to coord systems given
    in coord.

    Usage: matconv,do_conv,normcoord = get_coordconv_matrix(coord)

    Input:
       - coord: a tuple with initial and final coord systems.
                See normalise_coord.
    Output:
       - matconv: the euler matrix for coord sys conversion
       - do_conv: True if matconv is not identity, False otherwise
       - normcoord: the tuple of initial and final coord sys.

    History: adapted from CGIS IDL library.
Return the rotation matrix corresponding to coord systems given
    in coord.
Return the rotation matrix corresponding to coord systems given in coord .
def get_coordconv_matrix(coord):
    """Return the rotation matrix corresponding to coord systems given
    in coord.

    Usage: matconv,do_conv,normcoord = get_coordconv_matrix(coord)

    Input:
       - coord: a tuple with initial and final coord systems.
                See normalise_coord.
    Output:
       - matconv: the euler matrix for coord sys conversion
       - do_conv: True if matconv is not identity, False otherwise
       - normcoord: the tuple of initial and final coord sys.

    History: adapted from CGIS IDL library.
    """

    coord_norm = normalise_coord(coord)

    if coord_norm[0] == coord_norm[1]:
        matconv = np.identity(3)
        do_conv = False
    else:
        # eps = 23.452294 - 0.0130125 - 1.63889e-6 + 5.02778e-7
        # eps = eps * np.pi / 180.0

        # ecliptic to galactic
        # e2g = np.array(
        #     [
        #         [-0.054882486, -0.993821033, -0.096476249],
        #         [0.494116468, -0.110993846, 0.862281440],
        #         [-0.867661702, -0.000346354, 0.497154957],
        #     ]
        # )

        # ecliptic to equatorial
        # e2q = np.array(
        #     [
        #         [1.0, 0.0, 0.0],
        #         [0.0, np.cos(eps), -1.0 * np.sin(eps)],
        #         [0.0, np.sin(eps), np.cos(eps)],
        #     ]
        # )

        # galactic to ecliptic
        g2e = np.linalg.inv(e2g)

        # galactic to equatorial
        g2q = np.dot(e2q, g2e)

        # equatorial to ecliptic
        q2e = np.linalg.inv(e2q)

        # equatorial to galactic
        q2g = np.dot(e2g, q2e)

        if coord_norm == ("E", "G"):
            matconv = e2g
        elif coord_norm == ("G", "E"):
            matconv = g2e
        elif coord_norm == ("E", "C"):
            matconv = e2q
        elif coord_norm == ("C", "E"):
            matconv = q2e
        elif coord_norm == ("C", "G"):
            matconv = q2g
        elif coord_norm == ("G", "C"):
            matconv = g2q
        else:
            raise ValueError("Wrong coord transform :", coord_norm)
        do_conv = True

    return matconv, do_conv, coord_norm
def get_coordconv_matrix ( coord ) : coord_norm = normalise_coord ( coord ) if coord_norm [ 0 ] == coord_norm [ 1 ] : matconv = np . identity ( 3 ) do_conv = False else : # eps = 23.452294 - 0.0130125 - 1.63889e-6 + 5.02778e-7 # eps = eps * np.pi / 180.0 # ecliptic to galactic # e2g = np.array( #     [ #         [-0.054882486, -0.993821033, -0.096476249], #         [0.494116468, -0.110993846, 0.862281440], #         [-0.867661702, -0.000346354, 0.497154957], #     ] # ) # ecliptic to equatorial # e2q = np.array( #     [ #         [1.0, 0.0, 0.0], #         [0.0, np.cos(eps), -1.0 * np.sin(eps)], #         [0.0, np.sin(eps), np.cos(eps)], #     ] # ) # galactic to ecliptic g2e = np . linalg . inv ( e2g ) # galactic to equatorial g2q = np . dot ( e2q , g2e ) # equatorial to ecliptic q2e = np . linalg . inv ( e2q ) # equatorial to galactic q2g = np . dot ( e2g , q2e ) if coord_norm == ( "E" , "G" ) : matconv = e2g elif coord_norm == ( "G" , "E" ) : matconv = g2e elif coord_norm == ( "E" , "C" ) : matconv = e2q elif coord_norm == ( "C" , "E" ) : matconv = q2e elif coord_norm == ( "C" , "G" ) : matconv = q2g elif coord_norm == ( "G" , "C" ) : matconv = g2q else : raise ValueError ( "Wrong coord transform :" , coord_norm ) do_conv = True return matconv , do_conv , coord_norm