#!/usr/bin/perl
# 
# subtract master darks from a set of raw images
#

# if set to 0, will not actually do work, just print commands
$do_it = 1;

$dark="dark10.fts";

@files1 = glob("wz_?.0??");
#@files2 = glob("be87_*.???");
#@files3 = glob("m13_*.???");
foreach $file (@files1) {
  $img = $file;
  $cmd = "sub $img $dark";
  printf "cmd is $cmd\n";
  if ($do_it == 1) {
    $result = `$cmd`;
  }
  printf "result of sub is ..$result..\n";

  $datestr = `date`;
  $comment = "subtracted dark $dark on $datestr";
  $cmd = "comment $img $comment";
  printf "cmd is $cmd\n";
  if ($do_it == 1) {
    $result  = `$cmd`;
  }
  printf "result of comment is ..$result..\n";

}


exit 0;
  
