Viewing contents of file '../idllib/contrib/icur/euler.pro'
;************************************************************************
PRO EULER,AI,BI,AO,BO,SELECT ; from IDL USERs S/W
;+
; NAME:
; EULER
; PURPOSE:
; Transform between galactic, celestial, and ecliptic coordinates.
; Use the procedure ASTRO to use this routine interactively
; CALLING SEQUENCE:
; EULER,AI,BI,AO,BO,[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(1950) GAL.(ii) | 4 ECLIPTIC RA-DEC
; 2 GAL.(ii) RA-DEC | 5 ECLIPTIC GAL.(ii)
; 3 RA-DEC ECLIPTIC | 6 GAL.(ii) ECLIPTIC
;
; If omitted, program will prompt for the value of SELECT
; OUTPUTS:
; AO - Output Longitude in DEGREES
; BO - Output Latitude in DEGREES
; REVISION HISTORY:
; Written W. Landsman, February 1987
; Adapted from Fortran by Daryl Yentis NRL
;-
twopi = 6.2831853072d
fourpi = 12.566370614d
cdr = 360./twopi
;
psi = [ 0.57595865315D, 4.9261918136D, $
0.00000000000D, 0.0000000000D, $
0.11129056012D, 4.7005372834D]
stheta =[ 0.88781538514D,-0.88781538514D, $
0.39788119938D,-0.39788119938D, $
0.86766174755D,-0.86766174755D]
ctheta =[ 0.46019978478D, 0.46019978478D, $
0.91743694670D, 0.91743694670D, $
0.49715499774D, 0.49715499774D]
phi = [ 4.9261918136D, 0.57595865315D, $
0.0000000000D, 0.00000000000D, $
4.7005372834d, 0.11129056012d]
;
npar = n_params(0)
if npar lt 5 then begin
print,' '
print,' 1 RA-DEC(1950) TO GAL.(ii)
print,' 2 GAL.(ii) TO RA-DEC
print,' 3 RA-DEC TO ECLIPTIC
print,' 4 ECLIPTIC TO RA-DEC
print,' 5 ECLIPTIC TO GAL.(ii)
print,' 6 GAL.(ii) TO ECLIPTIC
;
read,'Enter selection',select
endif
I = select - 1 ; IDL offset
a = ai/cdr - phi(i)
b = bi/cdr
sb = sin(b) & cb = cos(b)
cbsa = cb * sin(a)
b = -stheta(i) * cbsa + ctheta(i) * sb
bo = asin(b<1.0d)*cdr
;
a = atan(ctheta(i) * cbsa + stheta(i) * sb, cb * cos(a))
;
; factor of 1./(cos(bo)) removed from both sin(a) and cos(a)
;
ao = ((a+psi(i)+fourpi) mod twopi) * cdr
if npar eq 2 then begin
ai = ao & bi=bo
endif
return
end