#!/usr/bin/perl
#
# Make figures showing all observations of EI Psc during 2005
#
# MWR 8/18/2005

# datafile with VSNET data (mostly visual) converted to JD
$vis_file = "./vsnet_obs.converted";

$cmdfile = "make_summary_graph.gnu";
$psfile = "make_summary_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: mixture of most reported visual and CCD measurements' \n";
printf CMDFILE "plot [3565:3610][17:11] ";
printf CMDFILE " '$vis_file' using (\$1):(\$2) ";
printf CMDFILE "     with points t 'VSNET reports' lt -1 pt 5 ps 0.8 lw 2  ";
printf CMDFILE " , ";
# now the RIT measurements
printf CMDFILE " 'eipsc_aug08ut.dat' using 2:(\$4-0.5) t 'RIT Obs' lt 1 pt 2 ps 0.5 lw 2 ";
printf CMDFILE " , ";
printf CMDFILE " 'eipsc_aug10ut.dat' using 2:(\$4-0.5) t '' lt 1 pt 2 ps 0.5 lw 2 ";
printf CMDFILE " , ";
printf CMDFILE " 'eipsc_aug17ut.dat' using 2:(\$4-0.5) t '' 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 " , ";
printf CMDFILE " 'cook_592.dat' using 1:(\$2+12.37) t 'CBA Pahala' lt 2 pt 3 ps 0.5 lw 2 ";
printf CMDFILE " , ";
printf CMDFILE " 'cook_593.dat' using 1:(\$2+12.37) t ''  lt 2 pt 3 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;
