#!/usr/bin/perl
#
# Make figures showing late CCD measurements of EI Psc from RIT Obs
#
# MWR 8/18/2005

$cmdfile = "make_lateccd_graph.gnu";
$psfile = "make_lateccd_graph.ps";
open(CMDFILE, ">$cmdfile") || die("can't open $cmdfile");
printf CMDFILE "set output '$psfile' \n";
printf CMDFILE "set term postscript color enhanced 'Helvetica bold' \n";
printf CMDFILE "set key top left \n";
printf CMDFILE "set grid \n";
printf CMDFILE "set xlabel 'Julian Date - 2,450,000 (no heliocentric correction)' \n";
printf CMDFILE "set ylabel 'unfiltered or visual magnitude'  \n";
printf CMDFILE "set title 'EI Psc in 2005: later CCD measurements' \n";
printf CMDFILE "plot [3599.5:3600.8][16:13.5] ";
# now the RIT measurements
printf CMDFILE " 'eipsc_aug17ut.dat' using 2:(\$4-0.5) t 'RIT Obs' lt 1 pt 2 ps 0.5 lw 2 ";
printf CMDFILE " , ";
printf CMDFILE " 'eipsc_aug18ut.dat' using 2:(\$4-0.5) t '' lt 1 pt 2 ps 0.5 lw 2 ";
printf CMDFILE " \n";

printf CMDFILE "quit \n";
close(CMDFILE);

$cmd = "gnuplot $cmdfile ";
printf "cmd is ..$cmd.. \n";
$ret = `$cmd`;
$giffile = $psfile;
$giffile =~ s/.ps/.gif/;
$cmd = "convert -rotate 90 $psfile $giffile";
printf "cmd is ..$cmd.. \n";
$ret = `$cmd`;




exit 0;
