#!/usr/bin/perl
#

############################################################################
# Light curve of WZ Sge on Aug 11, 2001 from RIT Obs
#
  

  $output_file = "wzsge_aug11_a.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 ylabel 'Differential I magnitude' \n";
  printf CMDFILE "set xlabel 'Julian Date - 2,450,000' \n";
  printf CMDFILE "set title 'WZ Sge in I-band, RIT Obs, UT 2001 Aug 11'\n";
  
  $cmd = "plot [][1.75:1.40] 'wzsge_aug11ut.dat' using (\$2-0):4  ";
  $cmd .= "    lt 1 pt 3 ps 0.2 lw 4 t '' ";

  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/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }





exit 0;
