#!/usr/local/bin/perl
#
$prog	   = "/f/mwhite/work/lyasim/tau2flux";
$power     = "/f/mwhite/work/lyasim/fluxpk";
$delpk     = "/f/mwhite/work/lyasim/delpk";
$base      = "/cdm3/www/mwhite/htdocs/Lya";
$nout      = 10;
$species   = "H";
@modellist = (
		"OS60A", "OS60B", "OS60C",
             );

@zz     = (8.50, 6.00, 5.50, 5.00, 4.00, 3.89, 3.10, 3.00, 2.75, 2.41);
for ($iout=0; $iout<$nout; $iout++) {
  @taueff[$iout] = 0.0028*exp(3.46*log(1+@zz[$iout]));
}

  foreach $model (@modellist) {

    print "Changing to directory $base/$model\n";
    chdir("$base/$model");

    for ($iout=0; $iout < $nout; $iout++) {
      $cmd = sprintf "%s tau_%s_%d.dat %f %f > flux_%d.dat",
        $prog,$species,$iout,@zz[$iout],@taueff[$iout],$iout;
      print "$cmd\n";  $output=`$cmd`;
      if ($output) {print "$output";}
#
      $cmd = sprintf "gzip -f flux_%d.dat",$iout;
      print "$cmd\n";  $output=`$cmd`;
      if ($output) {print "$output";}
#
      $cmd = sprintf "%s tau_%s_%d.dat %f %f > power_%d.dat",
        $power,$species,$iout,@zz[$iout],@taueff[$iout],$iout;
#      $cmd = sprintf "%s del_%d.dat vel_%d.dat %s %f %f 100. > power_%d.dat",
#        $power,$iout,$iout,"source.lst",@zz[$iout],@taueff[$iout],$iout;
      print "$cmd\n";  $output=`$cmd`;
      if ($output) {print "$output";}
#
      $cmd = sprintf "%s del_%d.dat > delpk_%d.dat",$delpk,$iout,$iout;
      print "$cmd\n";  $output=`$cmd`;
      if ($output) {print "$output";}
    }
    `chmod og+r \*`;
  }
