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) ; 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) FOR it = 0,ntime-1 DO BEGIN resample, wave,frame(*,it),w(0),w(nw-1),dw ENDFOR xs=fltarr(nw) window,1 & tvscl,frame(0:nw-1,*) FOR iw = 0,nw-1 DO BEGIN & xs(iw)=total(frame(iw,*)) & ENDFOR window,2 & 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