diff options
Diffstat (limited to 'mass_profile')
-rwxr-xr-x | mass_profile/analyze_fx.py | 32 | ||||
-rwxr-xr-x | mass_profile/analyze_lxfx.py (renamed from mass_profile/analyze_lx.py) | 0 | ||||
-rwxr-xr-x | mass_profile/calc_lxfx.sh | 34 |
3 files changed, 20 insertions, 46 deletions
diff --git a/mass_profile/analyze_fx.py b/mass_profile/analyze_fx.py deleted file mode 100755 index 4f72f57..0000000 --- a/mass_profile/analyze_fx.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -import numpy - -fx1_array=[] -fx2_array=[] -fx3_array=[] -for i in open('summary_fx.dat'): - x1,x2,x3=i.split() - x1=float(x1) - x2=float(x2) - x3=float(x3) - fx1_array.append(x1) - fx2_array.append(x2) - fx3_array.append(x3) - - -fx1_array=numpy.array(fx1_array) -fx2_array=numpy.array(fx2_array) -fx3_array=numpy.array(fx3_array) - - -f=open('fx_result.txt','w') -f.write("Fx(bolot)= %4.2E +/- %4.2E erg/s/cm^2\n"%(fx1_array[0],fx1_array.std())) -print("Fx(bolot)= %4.2E +/- %4.2E erg/s/cm^2"%(fx1_array[0],fx1_array.std())) -f.write("Fx(0.7-7)= %4.2E +/- %4.2E erg/s/cm^2\n"%(fx2_array[0],fx2_array.std())) -print("Fx(0.7-7)= %4.2E +/- %4.2E erg/s/cm^2"%(fx2_array[0],fx2_array.std())) -f.write("Fx(0.1-2.4)= %4.2E +/- %4.2E erg/s/cm^2\n"%(fx3_array[0],fx3_array.std())) -print("Fx(0.1-2.4)= %4.2E +/- %4.2E erg/s/cm^2"%(fx3_array[0],fx3_array.std())) - diff --git a/mass_profile/analyze_lx.py b/mass_profile/analyze_lxfx.py index c3d4030..c3d4030 100755 --- a/mass_profile/analyze_lx.py +++ b/mass_profile/analyze_lxfx.py diff --git a/mass_profile/calc_lxfx.sh b/mass_profile/calc_lxfx.sh index a943a42..1bce198 100755 --- a/mass_profile/calc_lxfx.sh +++ b/mass_profile/calc_lxfx.sh @@ -7,6 +7,9 @@ # Output: # * lx_result.txt # * fx_result.txt +# * summary_lx.dat +# * summary_fx.dat +# * lx_beta_param.txt / lx_dbeta_param.txt # # Author: Junhua GU # Created: 2013-06-24 @@ -107,8 +110,8 @@ FX1=`grep '^Fx1' ${LX_RES} | awk '{ print $2 }'` FX2=`grep '^Fx2' ${LX_RES} | awk '{ print $2 }'` FX3=`grep '^Fx3' ${LX_RES} | awk '{ print $2 }'` -echo $LX1 $LX2 $LX3 >summary_lx.dat -echo $FX1 $FX2 $FX3 >summary_fx.dat +echo "${LX1} ${LX2} ${LX3}" >summary_lx.dat +echo "${FX1} ${FX2} ${FX3}" >summary_fx.dat # save the calculated central values mv ${LX_RES} ${LX_RES%.txt}_center.txt @@ -118,8 +121,8 @@ mv lx_rho_fit.dat lx_rho_fit_center.dat # only calculate the central values if [ "${F_C}" = "YES" ]; then echo "Calculate the central values only ..." - ${base_path}/analyze_lx.py - ${base_path}/analyze_fx.py + ${base_path}/analyze_lxfx.py "Lx" summary_lx.dat lx_result.txt ${BLIST} + ${base_path}/analyze_lxfx.py "Fx" summary_fx.dat fx_result.txt ${BLIST} exit 0 fi @@ -139,19 +142,22 @@ for i in `seq 1 ${MC_TIMES}`; do exit 11 fi - echo >temp_sbp.cfg + # clear ${TMP_SBP_CFG} + TMP_SBP_CFG="temp_sbp.cfg" + # : > ${TMP_SBP_CFG} + [ -e "${TMP_SBP_CFG}" ] && rm -f ${TMP_SBP_CFG} cat ${sbp_cfg} | while read l; do if echo "${l}" | grep -q '^sbp_file' >/dev/null; then - echo "sbp_file temp_shuffled_sbp.dat" >>temp_sbp.cfg + echo "sbp_file temp_shuffled_sbp.dat" >> ${TMP_SBP_CFG} elif echo "${l}" | grep -q '^T_file' >/dev/null; then - echo "T_file ${T_file}" >>temp_sbp.cfg + echo "T_file ${T_file}" >> ${TMP_SBP_CFG} else - echo "${l}" >>temp_sbp.cfg + echo "${l}" >> ${TMP_SBP_CFG} fi done echo "### `pwd -P`" - echo "### $i ###" + echo "### $i / ${MC_TIMES} ###" ${base_path}/coolfunc_calc.sh ${T_file} $abund $nh $z $cfunc_file ${base_path}/coolfunc_calc_erg.sh ${T_file} $abund $nh $z "cfunc_" ${BLIST} ${base_path}/${PROG} temp_sbp.cfg ${rout} \ @@ -165,12 +171,12 @@ for i in `seq 1 ${MC_TIMES}`; do FX2=`grep '^Fx2' ${LX_RES} | awk '{ print $2 }'` FX3=`grep '^Fx3' ${LX_RES} | awk '{ print $2 }'` - echo $LX1 $LX2 $LX3 >>summary_lx.dat - echo $FX1 $FX2 $FX3 >>summary_fx.dat + echo "${LX1} ${LX2} ${LX3}" >>summary_lx.dat + echo "${FX1} ${FX2} ${FX3}" >>summary_fx.dat done # end of 'for' -# analyze lx & fx -${base_path}/analyze_lx.py -${base_path}/analyze_fx.py +# analyze Lx & Fx Monte Carlo results +${base_path}/analyze_lxfx.py "Lx" summary_lx.dat lx_result.txt ${BLIST} +${base_path}/analyze_lxfx.py "Fx" summary_fx.dat fx_result.txt ${BLIST} exit 0 |