pro lampdetail ;This progarm prints out the details from the lamp datasets for current Log. cd,'',current=cdir & cd,cdir ;establishes cdir as current directory cd,'DB/Lamp' ;files=findfile('*', count = nfiles) spawn,'lsf',files,/noshell s=size(files) nfiles=s(1) ;exit if there are no lamp datasets if files(0) eq '' then begin print, '****No files found here!****' goto, exit endif print,' One moment please....',string(10b) ;create a list of needed parameters list=fltarr(11,nfiles) ;list is: n,time,lamps,v1,v2,v3,a1,a2,a3,v_ssl,a_ssl by nfiles ave=fltarr(16) ;ave is: sum (v1..v3, a1..a3, v_ssl, a_ssl), no(v's, a's, ssl's) for i=0,nfiles-1 do begin ;read in data... d_read,files(i),h0,p0 list(*,i)=[i,d_value(h0,88),d_value(h0,102),d_value(h0,159),d_value(h0,161),d_value(h0,163),$ d_value(h0,160),d_value(h0,162),d_value(h0,164),d_value(h0,165),d_value(h0,166)] ;;ave(0:7)=ave(0:7)+list(3:10,i) ;;if list(3,i) gt .1 then ave(8)=ave(8)+1 ;counts when on (volt>.1 curr>.01) ;;if list(4,i) gt .1 then ave(9)=ave(9)+1 ;;if list(5,i) gt .1 then ave(10)=ave(10)+1 ;calculate averages... if list(6,i) gt .01 then begin ;average only when current is greater than .01 amp ave(3)=ave(3)+list(6,i) ;L1 Current ave(11)=ave(11)+1 ;L1 Current count ave(0)=ave(0)+list(3,i) ;L1 Voltage ave(8)=ave(8)+1 ;L1 voltage count endif if list(7,i) gt .01 then begin ;average only when current is greater than .01 amp ave(4)=ave(4)+list(7,i) ;L2 Current ave(12)=ave(12)+1 ave(1)=ave(1)+list(4,i) ;L2 Voltage ave(9)=ave(9)+1 ;L2 voltage count endif if list(8,i) gt .01 then begin ;average only when current is greater than .01 amp ave(5)=ave(5)+list(8,i) ;L3 Current ave(13)=ave(13)+1 ave(2)=ave(2)+list(5,i) ;L3 Voltage ave(10)=ave(10)+1 ;L3 voltage count endif if list(9,i) gt .1 then begin ;average only when current is greater than .1 amp ave(7)=ave(7)+list(10,i) ;SSL Current ave(14)=ave(14)+1 ave(6)=ave(6)+list(9,i) ;SSL Voltage ave(15)=ave(15)+1 ;SSL voltage count endif ;;if list(10,i) gt .1 then ave(15)=ave(15)+1 endfor col_sort,list,1 ;sorts list by mission time ;since the lamp state is a string field, it must be re-read into a corrisponding string array lampstate=strarr(nfiles) for j=0,nfiles-1 do begin d_read,files(list(0,j)),h0,p0 ;reads in sorted order lampstate(j)=d_value(h0,102) endfor ;_____________________________________________________________________________ ;Print results... print,' # time lamp v1 v2 v3 a1 a2 a3 v_ssl a_ssl' print,'' for i=0,nfiles-1 do begin no=sstr(i+1) print,no,list(1,i),lampstate(i),list(3:10,i),$ format='(a4,f9.1,a6,8f7.3) endfor ;;ave(0)=ave(0)-.013*(nfiles-ave(8)) ;corrects for non-zero off voltages ;;ave(1)=ave(1)-.013*(nfiles-ave(9)) ;corrects for non-zero off voltages ;;ave(2)=ave(2)-.013*(nfiles-ave(10)) ;corrects for non-zero off voltages for i=8,15 do if ave(i) eq 0 then ave(i)=1 ;avoids 0 division when no data is present print,ave(0:7)/ave(8:15),format='(/,"Lamp ON Ave. = ",T21,8f7.4) ans='' print,'' read,'Do you want to create an output file (lampdetail.out)? (y or n): ',ans if ans eq 'y' then begin close,2 openw,2,cdir+'/lampdetail.out' printf,2,'This is the Calibration and SSL details for: ',cdir printf,2,'This list was created on: ',systime(0),string(10b) printf,2,' # time lamp v1 v2 v3 a1 a2 a3 v_ssl a_ssl' printf,2,'' for i=0,nfiles-1 do begin no=sstr(i+1) printf,2,no,list(1,i),lampstate(i),list(3:10,i),$ format='(a4,f9.1,a6,8f7.3) endfor printf,2,ave(0:7)/ave(8:15),format='(/,"Lamp ON Ave. = ",T21,8f7.4) close,2 endif exit: cd,cdir end