setting up complete automation of fortfile packaging

This commit is contained in:
caes 2016-06-22 01:24:05 -04:00
parent 51b2fb125f
commit 50c0b4a3d0
5 changed files with 67 additions and 44 deletions

View File

@ -1,26 +0,0 @@
#!/bin/bash
script_dir=$( cd $(dirname $0) ; pwd -P |sed 's@^\(.*\)/scripts.*@\1/scripts@')
basedir=`pwd`
if [[ -x $script_dir/../bin/interpolation_fix ]]
then
echo "Binary available. Proceeding."
else
echo "Binary unavailable. Exiting."
exit 9
fi
for fortfile in $@
do
if [[ -e $(basename $fortfile) ]]
then
mkdir -p uninterpolated
mv $fortfile uninterpolated
$script_dir/../bin/interpolation_fix uninterpolated/$(basename $fortfile) $fortfile
else
$script_dir/../bin/interpolation_fix $fortfile $(basename $fortfile)
fi
echo ""
done
exit 0

View File

@ -1,11 +1,55 @@
cldn=$1
cd cldn${cldn}
#!/usr/local/bin/bash
# This still isn't really generalized. Need to go to a
# specific directory of runs to run this. Feed it a list
# of column densities.
script_dir=$(
cd $(dirname $0) ;
pwd -P |sed 's@^\(.*\)/scripts.*@\1/scripts@'
)
base_dir=`pwd`
bin_dir="$script_dir/../bin"
cldndir=$1
cd $cldndir
mkdir -p fortfiles
cd fortfiles
# pwd
../../../../../bin/create_fort_files ../mpi_grid.out ../../../../../reference/linelist
tar cf ngc5548_mehdipour_4thdexgrid_cldn${cldn}.tar *
gzip ngc5548_mehdipour_4thdexgrid_cldn${cldn}.tar
mv ngc5548_mehdipour_4thdexgrid_cldn${cldn}.tar.gz ../..
echo "Directory ready. Calling fort file creation."
# $bin_dir/create_fort_files ../mpi_grid.out $script_dir/../reference/linelist
allfortnums=$(echo fort.*|sed 's@fort\.\([0-9]\+\)@\1@g')
inwTfortnums=$(grep 'InwT' fort.*|sed 's@^fort\.\([0-9]\+\):InwT.*@\1@')
echo "Generating inward diffuse tables for $(echo "$inwTfortnums"|wc -l) coordinates."
for inwTnum in $inwTfortnums
do
inwCnum=$(($inwTnum + 1))
inwDnum=$(($inwCnum + 1))
fortnumstoproc=""
for fortnum in $allfortnums
do
if [[ $fortnum > $inwCnum ]]
then
fortnumstoproc="$fortnum $fortnumstoproc"
fi
done
echo "Shifting $( echo "$fortnumstoproc"|wc -w ) files."
for fortnum in $fortnumstoproc
do
newnum=$(( $fortnum + 1 ))
mv fort.$fortnum fort.$newnum
done
echo "Writing inwD table to fort.$inwDnum"
$bin_dir/subtract_fortfiles fort.$inwTnum fort.$inwCnum > fort.$inwDnum
done
echo "Applying interpolative smoothing."
$script_dir/operations/bulk_interpolation_fix.sh fort.* > interpolation_report
tar cf ngc5548_mehdipour_4thdexgrid_${cldndir}.tar *
gzip ngc5548_mehdipour_4thdexgrid_${cldndir}.tar
mv ngc5548_mehdipour_4thdexgrid_${cldndir}.tar.gz $base_dir/..

View File

@ -184,15 +184,15 @@ agn::cloudy_grid agn::read_cloudy_grid(std::ifstream& inputfile) {
pos = inputline.find(seek_string);
if (pos != std::string::npos) break;
}
if(agn::debug) std::cout
<< "Collecting grid meta data starting on line "
<< line_num
if(agn::debug) std::cout
<< "Collecting grid meta data starting on line "
<< line_num
<< std::endl;
agn::gridcoordlist coordlist;
std::pair<double,double> xy (0,0);
seek_string="**************************************************";
while(!inputfile.eof()) {
while (inputline.find(seek_string) == std::string::npos)
while (inputline.find(seek_string) == std::string::npos)
getline(inputfile,inputline);
while(inputfile.peek() == ' ') inputfile.get(); // Skip blank space
// Break for first grid

View File

@ -215,8 +215,13 @@ std::list<agn::eqwidth_table> agn::compile_eqwidth_tables(agn::cloudy_grid grid,
<< "Processing label "
<< *line_label_it
<< std::endl;
new_table.header[0] = *line_label_it;
new_table.header[0].append(" relative to Inci 1215.00A scaled to 1215.00A");
std::stringstream header0;
header0
<< *line_label_it
<< " relative to Inci 1215.00A scaled to "
<< scale_factor
<< "A.";
new_table.header[0] = header0.str();
new_table.header[1] = "Hden Phi(H) Eq_Width (A)";
agn::cloudy_grid::iterator result_it = grid.begin();
while (result_it != grid.end()) {

View File

@ -59,22 +59,22 @@ int main(int argc, char const *argv[])
table2 >> hden2 >> phi2 >> magnitude2;
resultant_magnitude[i] = magnitude1[i] - magnitude2;
}
if ( resultant_magnitude[i] < 1e-10 )
if ( resultant_magnitude[i] < 1e-10 )
resultant_magnitude[i]=1e-10;
}
std::cout
std::cout
<< first_line
<< std::endl
<< "HDen Phi(H) ScaInten"
<< std::endl;
for (int i=0; i<table_entries; i++) {
std::cout
<< std::fixed
<< std::setprecision(3)
std::cout
<< std::fixed
<< std::setprecision(3)
<< hden1[i]
<< " "
<< phi1[i]