#!/usr/bin/perl
#
# Compute the difference in distance mod between benchmark model
#      Omega_M = 1.0
# 
# and other models, as a function of redshift.
#
# MWR 5/10/2011

$debug = 1;


$omega_lambda = 0.0;
$H0 = 70.0;
$benchmark_omega = 0.30;
$benchmark_lambda = 0.50;
$output_prefix = "./delta_lumdist";

@omega_list = (0.20, 0.30, 0.40);
@omega_lambda_list = (0.40, 0.50, 0.6);
foreach $omega (@omega_list) {

 foreach $lambda (@omega_lambda_list) {

  # paste together the lumdist*.dat files for 
  #    the benchmark and this omega
  $bench_file = sprintf "lumdist_%05.2f_%05.2f_%06.1f.dat",
      $benchmark_omega, $benchmark_lambda, $H0;

  $this_file = sprintf "lumdist_%05.2f_%05.2f_%06.1f.dat",
      $omega, $lambda, $H0;

  $output_file = sprintf "%s_%05.2f_%05.2f.dat",
       $output_prefix, $omega, $lambda;

  $cmd = "paste $this_file $bench_file > $output_file ";
  $ret = exec_cmd($cmd);

 }
}
 







exit 0;





##############################################################################
# PROCEDURE: exec_cmd
#
# DESCRIPTION: Execute the given shell command line.  If the $debug flag
#              is set, we print to stdout the command line, and
#              also print out the result string.
#
# RETURNS:
#              the result of the command
#
#
sub exec_cmd {

  my($cmd, $ret);

  $cmd = $_[0];

  if ($debug > 0) {
    printf "cmd is ..$cmd.. \n";
  }
  $ret = `$cmd`;
  if ($debug > 0) {
    printf "ret is ..$ret.. \n";
  }

  return($ret);
}


