#!/usr/bin/perl
#

#$target = "pnv1915_";
$target = "iyuma";
#$target = "ngc6418_";
$filter = "";
$filter_lc = lc($filter);
$filter_uc = uc($filter);
$aper = "4";

@files = glob($target . $filter_lc . "*.pht");

$cmd  = "~/junk/ensemble-0.7/multipht ";
if ($aper eq "3") {
  $cmd .= " x=1 y=2 mag=5 err=6 jd=12 ";
}
elsif ($aper eq "4") {
  $cmd .= " x=1 y=2 mag=7 err=8 jd=12 ";
}
elsif ($aper eq "5") {
  $cmd .= " x=1 y=2 mag=9 err=10 jd=12 ";
}
else {
  printf " invalid aper $aper \n";
  exit(1);
}
#$cmd .= " template=uzboo_clear-004.pht ";
#$cmd .= " outfile=multi3_" . $filter_lc . ".out ";
$cmd .= " outfile=multi_" . $target . $aper . "_" . $filter_lc . ".out ";
$cmd .= " matchrad=3 ";
foreach $file (@files) {
  $cmd .= " $file ";
}

printf "cmd is ..$cmd.. \n";

exec($cmd);
#printf "ret is ..$ret.. \n";


exit 0;
