#!/usr/bin/perl # create a list of file to plot system("ls -1 ABU*DAT > selem_file.list"); # create a template gnuplot file open(graph,"> graph.gnu"); print graph "set terminal postscript enha landscape \n"; print graph "set output 'graph.ps' \n"; print graph "set title 'ThisIsTheTitle' \n"; print graph "set myti 10 \n"; print graph "set mxti 10 \n"; print graph "set yra [-2:1.] \n"; print graph "set pointsize 0.3 \n"; print graph "set xra [0.4:0.6] \n"; print graph "set xlabel 'mass coordinate' \n"; print graph "set ylabel 'X (mass fraction) \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 'graph.DAT' u 2:(log10(\$9)) tit '^4He' wi linesp 1 5 \n"; close(graph) ; open(selist,"selem_file.list"); while () { # # read the header of the data file # chop($fileselem=$_); print Reading $fileselem."\n" ; open(sfile,$fileselem); $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,"graph.gnu"); open(graphtmp,"> graphtmp.gnu"); while () { if (/graph.DAT/){ s/graph.DAT/$fileselem/; 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 graphtmp.gnu"); #system("cp graph.ps plot".substr($fileselem,5,6)."ps"); system("convert -rotate 90 graph.ps plot".substr($fileselem,5,6)."gif "); }