pro HSTTitanSpectra ;,cube cube='D:\Documents\disr\VIMS\hst\stisdata\albedo\fits\O5CX010_cube.fits' nscan=18 npix=20 nwave=1021 Dir="c:\HST\" data=readfits(cube,h) ;pull max and min wavelengths from header... s=size(h) length=s(1) ;length of header for i=0,length-1 do begin flag1=strpos(h(i),"MINWAVE = ") flag2=strpos(h(i),"MAXWAVE = ") flag3=strpos(h(i),"/") ;position of "/" delimiter len=flag3-(flag2+10)-1 ;there is a space between the "/" and the value if flag1 ne -1 then minwave=float(strmid(h(i),10,len))*0.1 ;min wavelength in nm if flag2 ne -1 then maxwave=float(strmid(h(i),10,len))*0.1 ;max wavelength in nm endfor wstep= (maxwave-minwave)/1021 ;wave step in nm wave=fltarr(1021) ;make array of wavelength values... wave(0)= minwave for i=1,nwave-1 do wave(i)=wave(i-1)+wstep plot,wave,data(9,*,10) file_mkdir,Dir for j=0,nscan-1 do begin filename="HST_data"+sstr(j+1)+".dat" pixno=findgen(npix)+1 ;an array containing the pixel number (1 to 20) close,1 openw,1,Dir+filename printf,1,'HST spectra (I/F) for scan '+sstr(j+1)+' of: '+cube printf,1,' Wavl Pixel#...' formatx='(8x,'+sstr(npix)+'(i10))' printf,1,pixno,format=formatx for i=0,nwave-1 do printf,1,wave(i),data(j,i,0:19),format='(f10.2,20(f10.4))' close,1 endfor ;Create an array containing the average value of each spectrum called dataave(scan,pix) close,1 openw,1,Dir+"MeanOfSpectra.dat" printf,1,'This is table of the average amplitude of each spectrum' printf,1,' Scan Pixel#...' formatx='(8x,'+sstr(npix)+'(i10))' printf,1,pixno,format=formatx dataave=fltarr(18,21) for i=0,nscan-1 do begin for j=0,npix-1 do dataave(i,j)=mean(data(i,0:nwave-1,j)) printf,1,i+1,dataave(i,0:npix-1),format='(f10.2,20(f10.4))' ;each pixel for that scan endfor show3,dataave maxx=where(dataave eq max(dataave)) maxpix=fix((maxx+1)/nscan)+1 maxscan=(maxx+1)-(maxpix-1)*nscan print,'The maximum spectrum is at scan '+sstr(maxscan)+' and pixel '+sstr(maxpix) close,1 stop Print,'Done!' end