#!/usr/bin/perl
# 


# plot showing the fiducial filter set, filters B1, B6, B8
$title = "Fiducial (Johnson-like) filters 1, 6, 8";
$cmdfile = "make_filterset_plots_a.gnu";
$psfile = "make_filterset_plots_a.ps";
open(CMDFILE, ">$cmdfile") || die("can't open $cmdfile");
printf CMDFILE "set output '$psfile' \n";
printf CMDFILE "set term postscript color \n";
printf CMDFILE "set grid \n";
printf CMDFILE "set key top left \n";
printf CMDFILE "set xlabel 'Wavelength (nm)' \n";
printf CMDFILE "set ylabel 'Transmission '  \n";
printf CMDFILE "set title '$title'  \n";
printf CMDFILE "plot [300:2000][-0.05:1.2] ";
printf CMDFILE " 'pickles_convolve/fiducial_b1.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with points t 'filter 1' ps 1.5 lw 3  ";
printf CMDFILE " , ";
printf CMDFILE " 'pickles_convolve/fiducial_b6.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with points t 'filter 6' ps 1.5 lw 3  ";
printf CMDFILE " , ";
printf CMDFILE " 'pickles_convolve/fiducial_b8.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with points t 'filter 8' ps 1.5 lw 3  ";
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`;



# plot showing the "B8" filter set, filters 2, 6, 8
$title = "B8 (sharp-edged) filters 2, 6, 8";
$cmdfile = "make_filterset_plots_b.gnu";
$psfile = "make_filterset_plots_b.ps";
open(CMDFILE, ">$cmdfile") || die("can't open $cmdfile");
printf CMDFILE "set output '$psfile' \n";
printf CMDFILE "set term postscript color \n";
printf CMDFILE "set grid \n";
printf CMDFILE "set key top left \n";
printf CMDFILE "set xlabel 'Wavelength (nm)' \n";
printf CMDFILE "set ylabel 'Transmission '  \n";
printf CMDFILE "set title '$title'  \n";
printf CMDFILE "plot [300:2000][-0.05:1.2] ";
printf CMDFILE " 'b8_filters/b8_2.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 2' ps 1.5 lw 3  ";
printf CMDFILE " , ";
printf CMDFILE " 'b8_filters/b8_6.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 6' ps 1.5 lw 3  ";
printf CMDFILE " , ";
printf CMDFILE " 'b8_filters/b8_8.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 8' ps 1.5 lw 3  ";
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);





