#!/usr/bin/perl # create a list of file to plot system("ls -1 GRID*DAT > grid_file.list"); # create a template gnuplot file open(graph,"> grid.gnu"); print graph "set terminal postscript enha landscape color\n"; print graph "set output 'grid.ps' \n"; print graph "set title 'ThisIsTheTitle' \n"; print graph "set myti 10 \n"; print graph "set mxti 10 \n"; print graph "set yra [-10:5.] \n"; print graph "set pointsize 0.5 \n"; print graph "set xra [0.42:0.6] \n"; print graph "set xlabel 'mass coordinate' \n"; print graph "set ylabel 'Grid terms (1/dxm) \n"; #print graph "set logs y \n"; # the plot columns relate to isotopes in the following way: # isotope number from networksetup.txt print graph "plot 'GRID.DAT' u 2:(log10(\$3)) tit 'gf' wi linesp -1 1\\\n"; print graph ",'GRID.DAT' u 2:(log10(\$4)) tit 'gfa' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$5)) tit 'gfb' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$7)) tit 'gfc(H)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$9)) tit 'gfd(H)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$12)) tit 'gfc(^4He)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$15)) tit 'gfd(^4He)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$18)) tit 'gfc(C13)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$21)) tit 'gfd(C13)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$24)) tit 'gfc(O17)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$27)) tit 'gfd(O17)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$30)) tit 'gfc(O18)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$33)) tit 'gfd(O18)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$36)) tit 'gfc(NE21)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$39)) tit 'gfd(Ne21)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$42)) tit 'gfc(Ne22)' wi linesp \\\n"; print graph ",'GRID.DAT' u 2:(log10(\$45)) tit 'gfd(Ne22)' wi linesp \n"; close(graph) ; open(selist,"grid_file.list"); while () { # # read the header of the data file # chop($filegrid=$_); print "Reading ".$filegrid."\n" ; open(sfile,$filegrid); $sline1 = ; @saline=split(/\s+/,$sline1); $time=$saline[7]; $sline1 = ; @saline=split(/\s+/,$sline1); $temp9=$saline[4]; $rho=$saline[7]; $sline1 = ; @saline=split(/\s+/,$sline1); $densn=$saline[3]; print $time." ".$temp9." ".$rho." ".$densn."\n"; close(sfile); # # modify standard gnuplot plot file # open(graph,"grid.gnu"); open(graphtmp,"> gridtmp.gnu"); while () { if (/GRID.DAT/){ s/GRID.DAT/$filegrid/; print graphtmp $_ ; }elsif (/ThisIsTheTitle/){ $title="Age = ".$time.", T_9 = ".$temp9.", {/Symbol r} = ".$rho.", N_{n} = ".$densn; s/ThisIsTheTitle/$title/; print graphtmp $_ ; }else{ print graphtmp $_ ; } } close(graph); close(graphtmp); system("gnuplot gridtmp.gnu"); system("cp grid.ps plot".substr($filegrid,5,8)."ps"); system("convert -rotate 90 grid.ps plotgrid".substr($filegrid,5,8)."gif "); }