(ai, bi, select, FK4=0)
return ao, bo
NAME:
        euler
    PURPOSE:
        Transform between Galactic, celestial, and ecliptic coordinates.
    EXPLANATION:
        Use the procedure ASTRO to use this routine interactively

    CALLING SEQUENCE:
         EULER, AI, BI, AO, BO, [ SELECT, /FK4, SELECT = ]

    INPUTS:
          AI - Input Longitude in DEGREES, scalar or vector.  If only two
                  parameters are supplied, then  AI and BI will be modified
                  to contain the output longitude and latitude.
          BI - Input Latitude in DEGREES

    OPTIONAL INPUT:
          SELECT - Integer (1-6) specifying type of coordinate
                   transformation.

         SELECT   From          To        |   SELECT      From         To
          1     RA-Dec (2000)  Galactic   |     4       Ecliptic     RA-Dec
          2     Galactic       RA-DEC     |     5       Ecliptic    Galactic
          3     RA-Dec         Ecliptic   |     6       Galactic    Ecliptic

         If not supplied as a parameter or keyword, then EULER will prompt
         for the value of SELECT
         Celestial coordinates (RA, Dec) should be given in equinox J2000
         unless the /FK4 keyword is set.
    OUTPUTS:
          AO - Output Longitude in DEGREES
          BO - Output Latitude in DEGREES

    INPUT KEYWORD:
          /FK4 - If this keyword is set and non-zero, then input and output
                celestial and ecliptic coordinates should be given in
                equinox B1950.
          /SELECT  - The coordinate conversion integer (1-6) may
                     alternatively be specified as a keyword
    NOTES:
          EULER was changed in December 1998 to use J2000 coordinates as the
          default, ** and may be incompatible with earlier versions***.
    REVISION HISTORY:
          Written W. Landsman,  February 1987
          Adapted from Fortran by Daryl Yentis NRL
          Converted to IDL V5.0   W. Landsman   September 1997
          Made J2000 the default, added /FK4 keyword
           W. Landsman December 1998
          Add option to specify SELECT as a keyword W. Landsman March 2003
          Converted to python by K. Ganga December 2007
NAME:
        euler
    PURPOSE:
        Transform between Galactic, celestial, and ecliptic coordinates.
    EXPLANATION:
        Use the procedure ASTRO to use this routine interactively
NAME : euler PURPOSE : Transform between Galactic celestial and ecliptic coordinates . EXPLANATION : Use the procedure ASTRO to use this routine interactively
def euler(ai, bi, select, FK4=0):
    """
    NAME:
        euler
    PURPOSE:
        Transform between Galactic, celestial, and ecliptic coordinates.
    EXPLANATION:
        Use the procedure ASTRO to use this routine interactively

    CALLING SEQUENCE:
         EULER, AI, BI, AO, BO, [ SELECT, /FK4, SELECT = ]

    INPUTS:
          AI - Input Longitude in DEGREES, scalar or vector.  If only two
                  parameters are supplied, then  AI and BI will be modified
                  to contain the output longitude and latitude.
          BI - Input Latitude in DEGREES

    OPTIONAL INPUT:
          SELECT - Integer (1-6) specifying type of coordinate
                   transformation.

         SELECT   From          To        |   SELECT      From         To
          1     RA-Dec (2000)  Galactic   |     4       Ecliptic     RA-Dec
          2     Galactic       RA-DEC     |     5       Ecliptic    Galactic
          3     RA-Dec         Ecliptic   |     6       Galactic    Ecliptic

         If not supplied as a parameter or keyword, then EULER will prompt
         for the value of SELECT
         Celestial coordinates (RA, Dec) should be given in equinox J2000
         unless the /FK4 keyword is set.
    OUTPUTS:
          AO - Output Longitude in DEGREES
          BO - Output Latitude in DEGREES

    INPUT KEYWORD:
          /FK4 - If this keyword is set and non-zero, then input and output
                celestial and ecliptic coordinates should be given in
                equinox B1950.
          /SELECT  - The coordinate conversion integer (1-6) may
                     alternatively be specified as a keyword
    NOTES:
          EULER was changed in December 1998 to use J2000 coordinates as the
          default, ** and may be incompatible with earlier versions***.
    REVISION HISTORY:
          Written W. Landsman,  February 1987
          Adapted from Fortran by Daryl Yentis NRL
          Converted to IDL V5.0   W. Landsman   September 1997
          Made J2000 the default, added /FK4 keyword
           W. Landsman December 1998
          Add option to specify SELECT as a keyword W. Landsman March 2003
          Converted to python by K. Ganga December 2007
    """

    # npar = N_params()
    #  if npar LT 2 then begin
    #     print,'Syntax - EULER, AI, BI, A0, B0, [ SELECT, /FK4, SELECT= ]'
    #     print,'    AI,BI - Input longitude,latitude in degrees'
    #     print,'    AO,BO - Output longitude, latitude in degrees'
    #     print,'    SELECT - Scalar (1-6) specifying transformation type'
    #     return
    #  endif

    PI = np.pi
    twopi = 2.0 * PI
    fourpi = 4.0 * PI
    deg_to_rad = 180.0 / PI
    #
    # ;   J2000 coordinate conversions are based on the following constants
    # ;   (see the Hipparcos explanatory supplement).
    # ;  eps = 23.4392911111 # Obliquity of the ecliptic
    # ;  alphaG = 192.85948d           Right Ascension of Galactic North Pole
    # ;  deltaG = 27.12825d            Declination of Galactic North Pole
    # ;  lomega = 32.93192d            Galactic longitude of celestial equator
    # ;  alphaE = 180.02322d           Ecliptic longitude of Galactic North Pole
    # ;  deltaE = 29.811438523d        Ecliptic latitude of Galactic North Pole
    # ;  Eomega  = 6.3839743d          Galactic longitude of ecliptic equator
    #
    if FK4 == 1:

        equinox = "(B1950)"
        psi = [
            0.57595865315,
            4.9261918136,
            0.00000000000,
            0.0000000000,
            0.11129056012,
            4.7005372834,
        ]
        stheta = [
            0.88781538514,
            -0.88781538514,
            0.39788119938,
            -0.39788119938,
            0.86766174755,
            -0.86766174755,
        ]
        ctheta = [
            0.46019978478,
            0.46019978478,
            0.91743694670,
            0.91743694670,
            0.49715499774,
            0.49715499774,
        ]
        phi = [
            4.9261918136,
            0.57595865315,
            0.0000000000,
            0.00000000000,
            4.7005372834,
            0.11129056012,
        ]
    else:

        equinox = "(J2000)"
        psi = [
            0.57477043300,
            4.9368292465,
            0.00000000000,
            0.0000000000,
            0.11142137093,
            4.71279419371,
        ]
        stheta = [
            0.88998808748,
            -0.88998808748,
            0.39777715593,
            -0.39777715593,
            0.86766622025,
            -0.86766622025,
        ]
        ctheta = [
            0.45598377618,
            0.45598377618,
            0.91748206207,
            0.91748206207,
            0.49714719172,
            0.49714719172,
        ]
        phi = [
            4.9368292465,
            0.57477043300,
            0.0000000000,
            0.00000000000,
            4.71279419371,
            0.11142137093,
        ]
    #
    i = select - 1  # IDL offset
    a = ai / deg_to_rad - phi[i]
    b = bi / deg_to_rad
    sb = np.sin(b)
    cb = np.cos(b)
    cbsa = cb * np.sin(a)
    b = -stheta[i] * cbsa + ctheta[i] * sb
    # bo    = math.asin(where(b<1.0, b, 1.0)*deg_to_rad)
    bo = np.arcsin(b) * deg_to_rad
    #
    a = np.arctan2(ctheta[i] * cbsa + stheta[i] * sb, cb * np.cos(a))
    ao = np.fmod((a + psi[i] + fourpi), twopi) * deg_to_rad
    return ao, bo
def euler ( ai , bi , select , FK4 = 0 ) : # npar = N_params() #  if npar LT 2 then begin #     print,'Syntax - EULER, AI, BI, A0, B0, [ SELECT, /FK4, SELECT= ]' #     print,'    AI,BI - Input longitude,latitude in degrees' #     print,'    AO,BO - Output longitude, latitude in degrees' #     print,'    SELECT - Scalar (1-6) specifying transformation type' #     return #  endif PI = np . pi twopi = 2.0 * PI fourpi = 4.0 * PI deg_to_rad = 180.0 / PI # # ;   J2000 coordinate conversions are based on the following constants # ;   (see the Hipparcos explanatory supplement). # ;  eps = 23.4392911111 # Obliquity of the ecliptic # ;  alphaG = 192.85948d           Right Ascension of Galactic North Pole # ;  deltaG = 27.12825d            Declination of Galactic North Pole # ;  lomega = 32.93192d            Galactic longitude of celestial equator # ;  alphaE = 180.02322d           Ecliptic longitude of Galactic North Pole # ;  deltaE = 29.811438523d        Ecliptic latitude of Galactic North Pole # ;  Eomega  = 6.3839743d          Galactic longitude of ecliptic equator # if FK4 == 1 : equinox = "(B1950)" psi = [ 0.57595865315 , 4.9261918136 , 0.00000000000 , 0.0000000000 , 0.11129056012 , 4.7005372834 , ] stheta = [ 0.88781538514 , - 0.88781538514 , 0.39788119938 , - 0.39788119938 , 0.86766174755 , - 0.86766174755 , ] ctheta = [ 0.46019978478 , 0.46019978478 , 0.91743694670 , 0.91743694670 , 0.49715499774 , 0.49715499774 , ] phi = [ 4.9261918136 , 0.57595865315 , 0.0000000000 , 0.00000000000 , 4.7005372834 , 0.11129056012 , ] else : equinox = "(J2000)" psi = [ 0.57477043300 , 4.9368292465 , 0.00000000000 , 0.0000000000 , 0.11142137093 , 4.71279419371 , ] stheta = [ 0.88998808748 , - 0.88998808748 , 0.39777715593 , - 0.39777715593 , 0.86766622025 , - 0.86766622025 , ] ctheta = [ 0.45598377618 , 0.45598377618 , 0.91748206207 , 0.91748206207 , 0.49714719172 , 0.49714719172 , ] phi = [ 4.9368292465 , 0.57477043300 , 0.0000000000 , 0.00000000000 , 4.71279419371 , 0.11142137093 , ] # i = select - 1 # IDL offset a = ai / deg_to_rad - phi [ i ] b = bi / deg_to_rad sb = np . sin ( b ) cb = np . cos ( b ) cbsa = cb * np . sin ( a ) b = - stheta [ i ] * cbsa + ctheta [ i ] * sb # bo    = math.asin(where(b<1.0, b, 1.0)*deg_to_rad) bo = np . arcsin ( b ) * deg_to_rad # a = np . arctan2 ( ctheta [ i ] * cbsa + stheta [ i ] * sb , cb * np . cos ( a ) ) ao = np . fmod ( ( a + psi [ i ] + fourpi ) , twopi ) * deg_to_rad return ao , bo