#!/usr/bin/perl
#
# Given measurements of the solar parallax based on transit or Eros obs,
#    compute corresponding values of the AU
#
# MWR 4/11/2012

use POSIX;


$debug = 1;

# multiply by this to convert degrees to radians
$DEGTORAD = 3.1415926535897 / 180.0;

# Radius of the Earth (m)
$Re = 6.3781E6;



while (<STDIN>) {

  $line = $_;
  if ($line =~ /^#/) {
    next;
  }
  @words = split(/\s+/, " " . $line);

  $theta_arcsec = $words[3];
  $theta_deg = $theta_arcsec / 3600.0;
  $theta_rad = $theta_deg*$DEGTORAD;

  $au = $Re / tan($theta_rad);

  printf " %10.6f  %12.8e \n", $theta_arcsec, $au;

}

exit 0;

  

