Документ взят из кэша поисковой машины. Адрес оригинального документа : http://star.arm.ac.uk/~csj/idl/FAST/brucedata.pro
Дата изменения: Wed Aug 22 19:06:24 2007
Дата индексирования: Tue Oct 2 07:45:57 2012
Кодировка:

Поисковые слова: п п р р р р р р р р р р р р п п
PRO brucedata ;; Read in BRUCE models from FITS files

COMMON fileblock
COMMON fitsblock
COMMON procblock


fitsfile=' '
htime = 0.0

; Loop over data folders
FOR ib = 0,nfiles-1 DO BEGIN

; Open the timing file
timefile = folder(ib)+'/'+flabel(ib)+'0.times'
openr,1,timefile

; Loop over data files
FOR ifl = 0,nruns(ib)-1 DO BEGIN
fitsname = folder(ib)+'/'+flabel(ib)+string(ifl+1,format='(i4.4)')+'.fits'
IF nruns(ib) GT 999 THEN fitsname = folder(ib)+'/'+flabel(ib)+string(ifl+1,format='(i4.4)')+'.fits'
fitsname = strtrim(strcompress(fitsname, /remove_all),2)
IF ib EQ 0 THEN it = ifl
IF ib GT 0 THEN it = total(nruns(0:ib-1))+ifl

; Read the fits file
fitsdata = readfits(fitsname, fitshead, /silent)

; Read the times from the timing file
lablen = strlen( flabel(ib)+string(ifl+1,format='(i3.3)') )
IF nruns(ib) GT 999 THEN lablen = strlen( flabel(ib)+string(ifl+1,format='(i4.4)') )
stime = " "
readf,1,stime
slen = strlen ( stime )
reads, strmid( stime, lablen+2 ), htime
;; readf,1, htime, format='(x,F6.3)'
time(it) = htime / 24.0

; Copy the data
nwave = FXPAR(fitshead, 'NAXIS1')

; define the arrays if they do not exist
if (n_elements(spec) EQ 0 OR n_elements(wave) NE nwave) THEN BEGIN
wave = fltarr(nwave)
spec = fltarr(nwave,nspec)
specm = fltarr(nwave)
specf = fltarr(nwave,nspec)
specr = fltarr(nwave,nspec)
ENDIF

IF ifl GE nbomit THEN spec(0:nwave-1,it) = fitsdata(0:nwave-1,0,0)


ENDFOR


; Close the timing file
close,1


ENDFOR


; Establish wavelength data array
w0 = FXPAR(fitshead, 'CRVAL1')
dw = FXPAR(fitshead, 'CD1_1')
IF ( abs(nint(dw*10)/10. - dw) lt 0.001 ) THEN dw = nint(dw*10)/10.
; this was a fudge because ndf2fits corrupted the original data
p0 = FXPAR(fitshead, 'CRPIX1') - 1.
FOR iw = 0,nwave-1 DO BEGIN
wave(iw) = w0 + (iw -p0) * dw
ENDFOR

END