#!/usr/bin/perl
#
#
# Make some fake data on velocity and distance we can plot
#

use POSIX;

$debug = 1;

# value of H in km/sec/Mpc
$H = 70;
# speed of light in m/s
$c = 3e8;

$outfile = "hubble_fake_1.dat";
# velocity will be in m/s
$start_v = 1.0e3;
$end_v = (0.01*$c);
$d_v = 1.0e4;
open(OUTFILE, ">$outfile") || die("can't open file $outfile");
printf OUTFILE "# fake perfect Hubble-Law data \n";
printf OUTFILE "#  v(km/sec)  dist(Mpc)  (m-M) \n";

for ($v = $start_v; $v < $end_v; $v += $d_v) {

  # compute velocity in km/sec
  $v_kmsec = $v*0.001;

  # compute dist in Mpc
  $dist_mpc = $v_kmsec/$H;
  # and in pc
  $dist_pc = $dist_mpc*1.0e6;
  $distmod = 5.0*log10($dist_pc) - 5.0;
  printf OUTFILE "  %9.4e  %9.4e  %6.3f \n",
        $v_kmsec, $dist_mpc, $distmod;
}
close(OUTFILE);






exit 0;
