pro ir_comp,log1,log2 ; Created 8/7/97 by csee, last revised 8/11/97, csee ; This program takes the pixel by pixel difference between ir measurements in ; 2 different HC (co2) Logs (log1-log2). The plots are sent to the screen or printer. ; The program also creates an output file, 'ir_comp.out', which contains the variation ; of the difference (both positive & negative) from the mean of log1. ; Log1 is the default, and this program can be run from that log, in which ; case the passed parameter becomes Log2. cd,'',current=cdir & cd,cdir ;cdir is the current directory if n_params() eq 0 then begin print,'** Error, no log specified' goto,exit endif if n_params() eq 1 then begin log2 = log1 log1 = cdir endif !y.range=[0,0] ;Autoscale !x.range=[0,0] ;Autoscale !P.MULTI=[0,1,1,0,0] ; Setup output file cd,log1 close,1 openw,1,'ir_comp.out' printf,1,'' printf,1,'This is a comparison of the Ir, shutter closed, measurements from Logs:' printf,1,' Log 1 = ',log1 printf,1,' Log 2 = ',log2 printf,1,format='(/,"Results of a pixel by pixel subtraction (Log1-Log2).")' printf,1,format='(/,"Peak variations from the Mean:",/)' printf,1,$ format='(T13,"Temp 1",2x,"Temp 2",2x,"delta T",T38,"Up, Max.",T50,"Up Min.",T62,"Down Max.",T74,"Down Min.",/)' ; Setup for hardcopy print=0 ans='' print,'*Do you want the output to go to the printer?' read,'(y or n): ',ans if ans eq 'y' then begin print=1 set_plot,'ps' device,filename = '~/idl.ps',/palatino,/landscape endif dir1=log1+'/DB/Ir' dir2=log2+'/DB/Ir' cd,dir1 files1=findfile('*', count = nfiles1) ;creates file list cd,dir2 files2=findfile('*', count = nfiles2) ;creates file list if nfiles1 NE nfiles2 then print,"** Not an equal # of images in each directory" for n=0,2 do begin ; n is the file # index ;nfiles=strcompress(string(nfiles1-1)) ;print, "Which file do you wish to compare? (No. 0 thru " $ ; ,nfiles,".) To quit enter -1" ;read,n ;if n eq -1 then goto, exit cd,dir2 d_irread,files2(n),h2,p2,g2 d_hcont,files2,88,105,time2,temp2 ;creates time & temp arrays cd,dir1 d_irread,files1(n),h1,p1,g2 d_hcont,files1,88,105,time1,temp1 ;creates time & temp arrays p=p1-p2 ; use pixels 3:146 to trim 2 pixels from each end ;downward pmin1=min(p1(3:146,1)) pmax1d=max(p1(3:146,1)) pave1d=mean(p1(3:146,1)) pmin2d=min(p2(3:146,1)) pmax2d=max(p2(3:146,1)) pave2d=mean(p2(3:146,1)) pmind=min(p(3:146,1)) pmaxd=max(p(3:146,1)) paved=mean(p(3:146,1)) ;upward pmin1u=min(p1(3:146,3)) pmax1u=max(p1(3:146,3)) pave1u=mean(p1(3:146,3)) pmin2u=min(p2(3:146,3)) pmax2u=max(p2(3:146,3)) pave2u=mean(p2(3:146,3)) pminu=min(p(3:146,3)) pmaxu=max(p(3:146,3)) paveu=mean(p(3:146,3)) !P.multi=[0,1,3] ;set plot for 1x3 window !x.title='Pixels' !y.title='Counts, dn' plot,p1(*,1),title='Down, closed, First Log, file #'+sstr(n) plot,p2(*,1),title='Down, closed, Second Log, file #'+sstr(n) plot,p(*,1),title='Down, closed, Difference, file #'+sstr(n) wait,2 plot,p1(*,3),title='Up, closed, First Log, file #'+sstr(n) plot,p2(*,3),title='Up, closed, Second Log, file #'+sstr(n) plot,p(*,3),title='Up, closed, Difference, file #'+sstr(n) wait,1 ;reference to average (excursion from average) upmax=pmaxu-paveu upmin=pminu-paveu dnmax=pmaxd-paved dnmin=pmind-paved printf,1,sstr(n),temp1(n),temp2(n),temp1(n)-temp2(n),upmax,upmin,dnmax,dnmin, $ format='("File #",a,T11,3f8.2,T36,f8.2,"dn",T48,f8.2,"dn",T60,f8.2,"dn",T72,f8.2,"dn")' printf,1,100*upmax/pave1u,100*upmin/pave1u,100*dnmax/pave1d,100*dnmin/pave1d, $ format='("% of Log1",T36,f8.2,"%",T48,f8.2,"%",T60,f8.2,"%",T72,f8.2,"%",/)' endfor printf,1,format='(//,"ir_comp.pro rev. 8/11/97")' close,1 ; Print output if print eq 1 then begin cd,log1 spawn,'lp -ofp13 -olm5 ir_comp.out' ;print text file device,/close_file spawn,'lp ~/idl.ps' ;print plots set_plot,'x' endif exit: !y.range=[0,0] ;Autoscale !x.range=[0,0] ;Autoscale !P.MULTI=[0,1,1,0,0] cd,cdir end