#!/usr/bin/perl
# 
# Put Arne Henden's table of photometry into a convenient format
#
# MWR 3/1/2004

while (<STDIN>) {

  $line = $_;
  chomp($line);
  if ($line =~ /^#/) {
    next;
  }
  @words = split(/\s+/, $line);
  $ra = $words[1];
  $dec = $words[3];
  $vmag = $words[6];
  $bv = $words[7];
  $vr = $words[9];
  $ri = $words[10];

  $bmag = $vmag + $bv;
  if ($vr > 30) {
    $rmag = 99.0;
  } else {
    $rmag = $vmag - $vr;
  }
  if (($ri > 30) || ($rmag > 30)) {
    $imag = 99.0;
  } else {
    $imag = $rmag - $ri;
  }

  printf "%9.5f %9.5f  %6.3f %6.3f %6.3f %6.3f     %6.3f \n", 
           $ra, $dec, $bmag, $vmag, $rmag, $imag, $bv;

}


exit 0;
