Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/dev_pos_header.pro'
;+
; NAME:
; dev_pos_header
; PURPOSE:
; Copy device-axis information from structured array to FITS header.
; CALLING:
; fh_devpos = dev_pos_header( dev_axes )
; INPUTS:
; dev_axes = array of axis structures (from function dev_axes).
; OUTPUTS:
; Function returns FITS header, a string array.
; EXTERNAL CALLS:
; pro sxaddpar
; function N_struct
; HISTORY:
; Written: Frank Varosi NASA/GSFC 1993.
;-
function dev_pos_header, dev_axes
Ndevax = N_struct( dev_axes )
if (Ndevax LE 0) then begin
message,"first arg. must be device axes structure",/INFO
sxaddpar, fh_devpos, "nodevice", 0
return, fh_devpos
endif
;get positions of Klinger devices:
w = where( strupcase( dev_axes.dev_type ) EQ "KLINGER", nk )
for k = 0, nk-1 do begin
axist = dev_axes(w(k))
sxaddpar, fh_devpos, axist.dev_name + axist.name, $
string( axist.position, F=axist.format ) + $
" " + axist.units, axist.alias
endfor
;get positions of monochromator and filter wheel:
w = where( strupcase( dev_axes.dev_type ) EQ "MONOCHROMATOR", nk )
for k = 0, nk-1 do begin
axist = dev_axes(w(k))
if strlen( axist.name ) GT 0 then sxaddpar, fh_devpos, $
strmid( axist.dev_name,0,6 ) +"-"+ axist.name, $
string( axist.position, F=axist.format ) + $
" " + axist.units, axist.alias
endfor
w = where( strupcase( dev_axes.dev_type ) EQ "FILTER", nk )
for k = 0, nk-1 do begin
axist = dev_axes(w(k))
if strlen( axist.name ) GT 0 then sxaddpar, fh_devpos, $
strmid( axist.dev_name,0,6 ) +"-"+ axist.name, $
string( axist.position, F=axist.format ) + $
" " + axist.units, axist.alias
endfor
if N_elements( fh_devpos ) LE 0 then return, strarr( Ndevax )
w = where( strpos( fh_devpos, "END" ) GE 0, nw )
if (nw GT 0) then npos=w(nw-1) else npos=N_elements( fh_devpos )
if (npos LT Ndevax) then $
return,[ fh_devpos(0:npos-1), strarr( Ndevax-npos ) ]
return, fh_devpos
end