#!/usr/bin/perl
#
# Make plots for curve of binding energy
#
# MWR 5/4/2012
  
  my($output_file, $term_options);

  

  $output_file = "new_binding_energy.ps";
  $term_options = "postscript color enhanced 'Helvetica,18' ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Atomic Number' \n";
  printf CMDFILE "set ylabel 'Binding Energy per nucleon (Mev) ' \n";
  printf CMDFILE "set title 'Binding Energy of the Elements' \n";
  printf CMDFILE "set label 1 'H' at -4,0.3  \n";
  printf CMDFILE "set label 2 'He' at -4,6.8  \n";
  printf CMDFILE "set label 3 'C' at 1,7.6  \n";
  printf CMDFILE "set label 4 'Si' at 11,8.5  \n";
  printf CMDFILE "set label 5 'Fe' at 23,9.0  \n";
  printf CMDFILE "set label 6 'U' at 93,7.7  \n";
  
  $cmd = "plot [-10:100][0:10] ";
  $cmd .= " 'binding_energy.dat' ";
  $cmd .= "    using (\$2*1):(\$5)  t '' ";
  $cmd .= "    with linespoints pt 3 lc 1 lw 3 ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.png/;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


exit 0;


#  compare 6 and 16 volts
  $volt_A = 6.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2100:2300][0.0:0.04] ";
#  $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }

###################################
#  compare 7 and 16 volts
  $volt_A = 7.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2200:2400][0.01:0.075] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


###################################
#  compare 8 and 16 volts
  $volt_A = 8.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2300:2500][0.03:0.120] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



###################################
#  compare 9 and 16 volts
  $volt_A = 9.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2400:2600][0.05:0.175] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



###################################
#  compare 10 and 16 volts
  $volt_A = 10.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2400:2600][0.10:0.250] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



###################################
#  compare 11 and 16 volts
  $volt_A = 11.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2500:2700][0.15:0.335] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


###################################
#  compare 12 and 16 volts
  $volt_A = 12.0;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2600:2800][0.25:0.455] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }




###################################
#  compare 13 and 16 volts
  $volt_A = 13.01;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2600:2800][0.40:0.555] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



###################################
#  compare 14 and 16 volts
  $volt_A = 14.01;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2700:2900][0.55:0.705] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



###################################
#  compare 15 and 16 volts
  $volt_A = 15.01;
  $volt_B = 16.01;

  $input_file = sprintf "bolo_calc_%06.2f_%06.2f.out", $volt_A, $volt_B;
  $output_file = sprintf "bolo_calc_%06.2f_%06.2f.ps", $volt_A, $volt_B;
  $term_options = "postscript color enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'Guess temperature for voltage %6.2f ' \n", 
                            $volt_A;
  printf CMDFILE "set ylabel 'Ratio of line intensities' \n";
  printf CMDFILE "set title 'Blackbody experiment, compare voltages %6.2f and %6.2f ' \n", 
               $volt_A, $volt_B;
  
  $cmd = "plot [2800:3000][0.72:0.855] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$5)  t '500 nm' ";
  $cmd .= "    with lines lc 1 lw 3 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$6)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$7)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$8)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$9)  t '' ";
  $cmd .= "    with points lc 1 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$10)  t '600 nm' ";
  $cmd .= "    with lines lc 2 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$11)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$12)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$13)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$14)  t '' ";
  $cmd .= "    with points lc 2 ps 0.5 ";

  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$15)  t '700 nm' ";
  $cmd .= "    with lines lc 3 lw 3";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$16)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$17)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$18)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (\$3):(\$19)  t '' ";
  $cmd .= "    with points lc 3 ps 0.5 ";

 
 
 

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }




###################################
#  plot resistance versus my temperature

  $input_file = sprintf "mwr_resistance_2.dat";
  $output_file = sprintf "log_resistance_plot_2.ps";
  $term_options = "postscript mono enhanced ";
  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set key top left \n";
  printf CMDFILE "set xlabel 'log10 (Temperature in Kelvin) ' \n";
  printf CMDFILE "set ylabel 'log10 (Resistance in ohms) ' \n";
  printf CMDFILE "set title 'Blackbody experiment, using temperatures derived by Richmond method' \n";
  printf CMDFILE "set label 1 at 2.93,0.85 'slope = 1.45' \n";
  
  $cmd = "plot [][] ";
# $cmd = "plot [][] ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (log(\$4)/log(10.0)):(log(\$1/(0.001*\$3))/log(10.0)) ";
  $cmd .= "    with points ps 0.6 pt 5 ";
  $cmd .= "    t '' ";
  $cmd .= " , ";
  $cmd .= " '$input_file' ";
  $cmd .= "    using (log(\$4)/log(10.0)):(log(\$1/(0.001*\$2))/log(10.0)) ";
  $cmd .= "    with points ps 0.8 pt 6 ";
  $cmd .= "    t '' ";
  $cmd .= " , ";
  $cmd .= " -3.27+1.45*x t 'fit to high-temperature only' ";
  $cmd .= " , ";
  $cmd .= " -2.4+(1.22)*x t 'slope = 1.22'  ";
 
  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.eps/.gif/;
    $giffile =~ s/.ps/.gif/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }











exit 0;
