#!/bin/csh
set name = asp
foreach theta (0.0 0.4 0.6 0.8 1.0 1.2 1.4)
foreach thetax (0.4 0.6 0.8 1.0 1.2 1.4)
    set dir = rex-$name.ph-10.4.theta-$theta-thetax-$thetax
    tar xvf $dir.tar
    cd $dir
    rexinfo.pl -bycond 0 > rexinfo-0.data
    extractLamb.pl 4 500 500 500 rexinfo-0.dat final.lamb
    mv rexinfo-0.data.lambda ../$dir.du
    cd ../
end
end

foreach theta (0.0 0.4 0.6 0.8 1.0 1.2 1.4)
    mkdir theta-$theta
    cd theta-$theta
    mv ../*theta-$theta.*.du .
    foreach file (`ls *.du`)
        cptAvgdU.pl $file 2 0
    end
  cat *.du.avg > ../$name.theta-$theta.du.dat
  rm -f *.du.avg
  mv *.du ../
  cd ../
  rmdir theta-$theta
end

foreach thetax (0.0 0.4 0.6 0.8 1.0 1.2 1.4 1.57)
    mkdir thetax-$thetax
    cd thetax-$thetax
    mv ../*thetax-$thetax.du .
    foreach file (`ls *.du`)
      cptAvgdU.pl $file 1 0
    end
    cat *.du.avg > ../$name.thetax-$thetax.du.dat
    rm -f *.du.avg
    mv *.du ../
    cd ../
    rmdir thetax-$thetax
end
