; $Id: rslice2.pro,v 1.1 2008/12/09 10:00:30 brandenb Exp $ ; ; show two different slices ; print,'1-d fields in the x-direction' ; iread=0 default,png,0 default,imgdir,'.' default,xsize,512 default,ysize,448 if png eq 0 then begin print,'write no png file (png=0)' endif else begin print,'write png file (png=1)' set_plot, 'z' ; switch to Z buffer loadct,2 device, SET_RESOLUTION=[xsize,ysize] ; set window size dev='z' endelse default,itpng,0 ;(image counter) ; file_slice1='data/proc0/slice_chemspec.xy' file_slice2='data/proc0/slice_chemspec2.xy' ; t=zero xy_slice1=one*fltarr(nx) xy_slice2=one*fltarr(nx) ; close,1 & openr,1,file_slice1,/f77 close,2 & openr,2,file_slice2,/f77 print,'files opened ok' ; ; set default waiting time w ; real all snapshots and plot ; l=20 m=3 n=70 default,w,.02 !p.charsize=2 ;!p.multi=[0,1,3] ;!z.margin=[15,2] zzz=z(n1:n2) xxx=x(l1:l2) ; openw,9,'rslice_table.dat' thick=3 while not eof(1) do begin readu,1,xy_slice1,t readu,2,xy_slice2,t xy_slicem=.5*(xy_slice1+xy_slice2) m=moments0(xxx,xy_slicem,fit=fit,/peri,/unnorm) print,t,m(1),m(4),m(3) printf,9,t,m(1),m(4),m(3) plot,xxx,xy_slice1,yr=[0,1.6] oplot,xxx,xy_slice1,col=122,thick=thick oplot,xxx,xy_slice2,col=55,thick=thick oplot,xxx,xy_slicem,li=2 oplot,xxx,fit,li=2,col=188 !p.title='!8t!6='+string(t,fo='(f6.2)') wait,w ; ; array for butterfly diagram ; if iread eq 0 then begin xy_slice1_arr=xy_slice1 xy_slice2_arr=xy_slice2 endif else begin xy_slice1_arr=[xy_slice1_arr,xy_slice1] xy_slice2_arr=[xy_slice2_arr,xy_slice2] endelse ; ; possibility of writing png files ; if png eq 1 then begin istr2 = strtrim(string(itpng,'(I20.4)'),2) ;(only up to 9999 frames) image = tvrd() ; ; make background white, and write png file ; ;bad=where(image eq 0) & image(bad)=255 tvlct, red, green, blue, /GET imgname = 'img_'+istr2+'.png' write_png, imgdir+'/'+imgname, image, red, green, blue itpng=itpng+1 ;(counter) ; endif iread=iread+1 end ; xy_slice1_arr=reform(xy_slice1_arr,nx,iread) xy_slice2_arr=reform(xy_slice2_arr,nx,iread) ; !p.multi=0 close,1 close,2 close,9 END