/usr/share/gnudatalanguage/astrolib/xyxy.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | PRO xyxy, hdra, hdrb, xa, ya, xb, yb
;+
; NAME:
; XYXY
; PURPOSE:
; To use a pair of headers to convert X/Y positions from one frame
; to another.
; CALLING SEQUENCE:
; XYXY, hdra, hdrb, xa, ya, [ xb, yb ]
; INPUTS:
; hdra - The header containing the plate solution describing the
; frame of reference being converted FROM.
; hdra - The header containing the plate solution describing the
; frame of reference being converted TO.
; xa - A scalar or vector containing the x coordinate(s) to convert.
; ya - A scalar or vector containing the y coordinate(s) to convert.
; Must have the same number of elements as 'xa'.
; OUTPUTS:
; xb - The converted x coordinate(s). If this parameter is not
; specified, it is returned through 'xa'.
; yb - The converted y coordinate(s). If this parameter is not
; specified, it is returned through 'ya'.
; PROCEDURE:
; The procedures 'xyad' and 'adxy' are used to perform the
; conversion. The equinoxes of each header are checked with
; "get_equinox" to make sure that they are identical, and "precess"
; is used if they are not. HEULER used if the headers have a different
; coordinate system (e.g. Celestial, Galactic, Ecliptic)
;
; Note that all X,Y coordinates are in the IDL convention (starting with
; 0,0) and not the FITS convention (first pixel is 1,1)
; PROCEDURES USED:
; GET_EQUINOX(), EXTAST, XYAD, ADXY, PRECESS, HEULER
; MODIFICATION HISTORY:
; Written by Michael R. Greason, Hughes-STX, 13 April 1992.
; Updated to use ASTROMETRY structures. J.D.Offenberg, HSTX, Jan 1993
; Check coordinate system J. Ballet/ W. Landsman April 2004
; Make sure output arrays supplied W. Landsman Feb 2017
;-
; Check parameters.
np = N_params()
if (np LT 4) then begin
print, "Syntax: xyxy, hdra, hdrb, xa, ya [, xb, yb]"
return
endif
Catch, theError
IF theError NE 0 then begin
Catch,/Cancel
void = cgErrorMsg(/quiet)
RETURN
ENDIF
if ( N_elements(xa) NE N_elements(ya) ) then begin
message,/CON, $
'ERROR - The first two parameters must have the same number of elements.'
return
endif
if (np EQ 4) && ~arg_present(xa) then begin
message,/CON, 'ERROR - No output variables supplied'
return
endif
epa = get_equinox( hdra, codea)
epb = get_equinox( hdrb, codeb)
; Extract the plate solutions from the headers. If
; either header hasn't a plate solution, set the
; output coordinates to the inputs and return.
;
extast, hdra, astra, noparamsa
extast, hdrb, astrb, noparamsb
IF ( (noparamsa LT 0) || (noparamsb LT 0)) THEN BEGIN
xb = xa
yb = ya
return
endif
;Convert between Celestial, Galactic, and Ecliptic if necessary
typea = strmid(astra.ctype[0],0,4)
typeb = strmid(astrb.ctype[0],0,4)
IF typea NE typeb THEN $
case typeb OF
'GLON': HEULER, astra, /GALACTIC
'RA--': HEULER, astra, /CELESTIAL
'ELON': HEULER, astra, /ECLIPTIC
ELSE : BEGIN
PRINT, 'Cannot convert between coordinate systems ', typea, $
' and ', typeb
RETURN
ENDELSE
ENDCASE
; Perform the conversion.
case strmid(astra.ctype[0],5,3) of
'GSS': gsssxyad, astra, xa, ya, a, d
else: xy2ad, xa, ya, astra, a, d
endcase
if ( codea GE 0 ) && (codeb GE 0) then $
if ( epa NE epb ) then $
precess, a, d, epa, epb
case strmid( astrb.ctype[0], 5,3) of
'GSS': gsssadxy, astrb, a, d, xb, yb
else: ad2xy, a, d, astrb, xb, yb
endcase
; If 'xb' and 'yb' weren't specified in the procedure
; call, overwrite xa and ya.
if ( np LT 6 ) then begin
xa = xb
ya = yb
endif
;
return
end
|