#!/usr/bin/perl
#

$ensemble_dir = "/w/wiyn/jan_2016/ensemble";

$target = "_iyuma";
$filter = "clear";
$uc_filter = uc($filter);
$lc_filter = lc($filter);

$aper = "3";
$infile = sprintf "multi%s%s_%s.out", $target, $aper, $lc_filter;
$outfile = sprintf "solve%s%s_%s.out", $target, $aper, $lc_filter;
$sigfile = sprintf "solve%s%s_%s.sig", $target, $aper, $lc_filter;
$imgfile = sprintf "solve%s%s_%s.img", $target, $aper, $lc_filter;


  $cmd = "$ensemble_dir/solvepht infile=$infile outfile=$outfile imfile=$imgfile sigfile=$sigfile ";
  $cmd .= " niter=2 ";

     $cmd .= " varstar=4 ";      #  the target
     $cmd .= " varstar=5 ";      #  saturated 
#     $cmd .= " varstar=138  ";       #  saturated?
#     $cmd .= " varstar=29 varstar=21 varstar=25 ";      #   satur?
#     $cmd .= " varstar=6  ";      #   satur?
#     $cmd .= " varstar=15 ";      #   satur?
#     $cmd .= " varstar=12 ";      #   HD 200830 is barely saturated
#      $cmd .= " varstar=159 ";      #   HD 200830 is barely saturated
#      $cmd .= " varstar=366 ";      #   HD 200830 is barely saturated
#      $cmd .= " varstar=170 varstar=136 varstar=45 ";      #   HD 200830 is barely saturated
#      $cmd .= " varstar=342 ";      #   HD 200830 is barely saturated
#      $cmd .= " varstar=1 varstar=0 ";      #  VEND variable
#      $cmd .= " varstar=235 varstar=101 ";      #  other vars?
#      $cmd .= " varstar=67 varstar=66 ";  # close double
#      $cmd .= " varstar=41 varstar=70 varstar=684 varstar=759  ";
#      $cmd .= " varstar=507 varstar=834 varstar=40 ";

#   the following images are bad:
#  $cmd .= " badim=71  badim=76  badim=80  badim=105 badim=31  badim=64  ";
#  $cmd .= " badim=114 badim=92  badim=112 badim=86  badim=111   ";
#  $cmd .= " badim=111 badim=73  badim=83  badim=94  badim=85  badim=38  ";
#  $cmd .= " badim=70  badim=82  badim=54  badim=4   badim=109 ";
#  $cmd .= " badim=6   badim=136 badim=167 badim=172 ";


printf "%s\n", $cmd;
$retval = `$cmd`;
printf "retval is ..%s..\n", $retval;

exit 0;
