Документ взят из кэша поисковой машины. Адрес оригинального документа : http://star.arm.ac.uk/~csj/idl/MSST/read_frame.pro
Дата изменения: Tue Aug 10 18:31:50 2004
Дата индексирования: Sun Apr 10 05:47:03 2016
Кодировка:
PRO read_frame, scope, folder, ffile, w, t, s

; Read Fits file and header

file = scope+'_'+folder+'/'+ffile+'.FITS_FINAL;1'
print,file
frame = readfits( file, fitshead )
window,0 & tvscl,frame

; Construct wavelength scale and timings from FITS header

IF scope EQ 'apo' THEN head_apo, fitshead, wave, time
IF scope EQ 'twin' THEN head_twin, fitshead, wave, time

nwave = n_elements(wave)
ntime = n_elements(time)


nw = n_elements(wave)
print,"WL:",10.^wave(0),10.^wave(nw-1)
xs=fltarr(nw)
FOR iw = 0,nw-1 DO BEGIN & xs(iw)=total(frame(iw,*)) & ENDFOR
window,1 & plot,10.^wave,xs


; Resample each row onto a wavelength scale with
; equal increments in log lambda.

nw = n_elements(w)
dw = (w(nw-1)-w(0)) / (nw-1)
newf = fltarr(nw,ntime)
FOR it = 0,ntime-1 DO BEGIN
y = frame(*,it)
x = wave
y = interpol ( y, x, w )
newf(*,it) = y(0:nw-1)
ENDFOR
wave = x(0:nw-1)
frame = newf

xs=fltarr(nw)
window,0 & tvscl,frame(0:nw-1,*)
FOR iw = 0,nw-1 DO BEGIN & xs(iw)=total(frame(iw,*)) & ENDFOR
window,1 & plot,w,xs



; Combine data with pre-existing data arrays and export

IF keyword_set(t) THEN BEGIN
IF t(0) GE 0 THEN BEGIN
t = [t,time]
nt = n_elements(t)
ss = s
print,"nt, nw, nt*nw ",nt,nw,nt*nw,n_elements(ss)+(ntime*nw)
s = fltarr(nw,nt)
s(*,0:nt-ntime-1) = ss
s(*,nt-ntime:nt-1) = frame(0:nw-1,*)
ENDIF ELSE BEGIN
t = time
s = frame(0:nw-1,*)
ENDELSE
ENDIF ELSE BEGIN
t = time
s = frame(0:nw-1,*)
ENDELSE



END