#!/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="dark30.fts";

@files1 = glob("iyuma-*.fit");
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";
  #  $comment = "subtracted bogus const=175 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;
  
