diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-06-07 22:38:20 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-06-07 22:38:20 +0800 |
commit | 5bbe958aa9c5b3ba98eee04c874bfd4be9836e26 (patch) | |
tree | 056235957d121447d8988388ae9ab8d5c41cd34a /mod_ly | |
parent | c5e35c06b0749641f91c5108e5007a63a4f1528d (diff) | |
download | chandra-acis-analysis-5bbe958aa9c5b3ba98eee04c874bfd4be9836e26.tar.bz2 |
Remove obsolete scripts
Diffstat (limited to 'mod_ly')
24 files changed, 0 insertions, 2714 deletions
diff --git a/mod_ly/coolfunc_0.1-2.4_calc.sh b/mod_ly/coolfunc_0.1-2.4_calc.sh deleted file mode 100755 index 7dc1a6a..0000000 --- a/mod_ly/coolfunc_0.1-2.4_calc.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh -# -# unalias -a -# -########################################################### -## Task: ## -## Calc `cooling function' data according to ## -## given `temperature profile' ## -## ## -## NOTE: ## -## given `tprofile': <radius> <temperature> ## -## calc `cooling function' by invoking `XSPEC' ## -## using model `wabs*apec' ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## August 17, 2012 ## -########################################################### - -## cmdline arguments {{{ -if [ $# -ne 5 ]; then - printf "usage:\n" - printf " `basename $0` <tprofile> <avg_abund> <nH> <redshift> <coolfunc_outfile>\n" - exit 1 -fi -base_path=`dirname $0` -TPROFILE=$1 -ABUND_VAL=$2 -N_H=$3 -REDSHIFT=$4 - -NORM=`$base_path/calc_distance $REDSHIFT|grep norm|awk '{print $2}'` -echo $NORM - -COOLFUNC_DAT=$5 -COOLFUNC_DAT_RATIO=flux_cnt_ratio.txt - -if [ ! -r "${TPROFILE}" ]; then - printf "ERROR: given tprofile '${TPROFILE}' NOT accessiable\n" - exit 2 -fi -[ -e "${COOLFUNC_DAT}" ] && rm -f ${COOLFUNC_DAT} -[ -e "${COOLFUNC_DAT_RATIO}" ] && rm -f ${COOLFUNC_DAT_RATIO} -## arguments }}} - -## specify variable name outside while loop -## otherwise the inside vars invisible -XSPEC_CF_XCM="_coolfunc_calc.xcm" -[ -e "${XSPEC_CF_XCM}" ] && rm -f ${XSPEC_CF_XCM} - -## generate xspec script {{{ -cat >> ${XSPEC_CF_XCM} << _EOF_ -## XSPEC Tcl script -## calc cooling function data -## -## generated by: `basename $0` -## date: `date` - -set xs_return_results 1 -set xs_echo_script 0 -# set tcl_precision 12 -dummyrsp .01 100 4096 -## set basic data {{{ -set nh ${N_H} -set redshift ${REDSHIFT} -set abund_val ${ABUND_VAL} -set norm ${NORM} -## basic }}} - -## xspec related {{{ -# debug settings {{{ -chatter 0 -# debug }}} -query yes -abund grsa -dummyrsp 0.3 11.0 1024 -# load model 'wabs*apec' to calc cooling function -model wabs*apec & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -## xspec }}} - -## set input and output filename -set tpro_fn "${TPROFILE}" -set cf_fn "${COOLFUNC_DAT}" -set cff_fn "${COOLFUNC_DAT_RATIO}" -if { [ file exists \${cf_fn} ] } { - exec rm -fv \${cf_fn} -} - -if { [ file exists \${cff_fn} ] } { - exec rm -fv \${cff_fn} -} - -## open files -set tpro_fd [ open \${tpro_fn} r ] -set cf_fd [ open \${cf_fn} w ] -set cff_fd [ open \${cff_fn} w ] - -## read data from tprofile line by line -while { [ gets \${tpro_fd} tpro_line ] != -1 } { - # gets one line - scan \${tpro_line} "%f %f" radius temp_val - #puts "radius: \${radius}, temperature: \${temp_val}" - # set temperature value - newpar 2 \${temp_val} - # calc flux & tclout - flux 0.7 7.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" holder holder holder cf_data - #puts "cf_data: \${cf_data}" - puts \${cf_fd} "\${radius} \${cf_data}" - flux 0.1 2.4 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" cff_data holder holder holder - puts \${cff_fd} "\${radius} [expr \${cff_data}/\${cf_data}]" -} - -## close opened files -close \${tpro_fd} -close \${cf_fd} -close \${cff_fd} - -## exit -tclexit -_EOF_ - -## extract xcm }}} - -## invoke xspec to calc -printf "invoking XSPEC to calculate cooling function data ...\n" -# xspec - ${XSPEC_CF_XCM} -xspec - ${XSPEC_CF_XCM} > /dev/null - -## clean -# if [ -e "${XSPEC_CF_XCM}" ]; then -# rm -f ${XSPEC_CF_XCM} -# fi - -exit 0 diff --git a/mod_ly/coolfunc_0.1-2.4_calc_rs.sh b/mod_ly/coolfunc_0.1-2.4_calc_rs.sh deleted file mode 100755 index 262e8ed..0000000 --- a/mod_ly/coolfunc_0.1-2.4_calc_rs.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -# -# unalias -a -# -########################################################### -## Task: ## -## Calc `cooling function' data according to ## -## given `temperature profile' ## -## ## -## NOTE: ## -## given `tprofile': <radius> <temperature> ## -## calc `cooling function' by invoking `XSPEC' ## -## using model `wabs*apec' ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## August 17, 2012 ## -########################################################### - -## cmdline arguments {{{ -if [ $# -ne 5 ]; then - printf "usage:\n" - printf " `basename $0` <tprofile> <avg_abund> <nH> <redshift> <coolfunc_outfile>\n" - exit 1 -fi -base_path=`dirname $0` -TPROFILE=$1 -ABUND_VAL=$2 -N_H=$3 -REDSHIFT=$4 - -NORM=`$base_path/calc_distance $REDSHIFT|grep norm|awk '{print $2}'` -echo $NORM - -COOLFUNC_DAT=$5 -COOLFUNC_DAT_RATIO=flux_cnt_ratio.txt - -if [ ! -r "${TPROFILE}" ]; then - printf "ERROR: given tprofile '${TPROFILE}' NOT accessiable\n" - exit 2 -fi -[ -e "${COOLFUNC_DAT}" ] && rm -f ${COOLFUNC_DAT} -[ -e "${COOLFUNC_DAT_RATIO}" ] && rm -f ${COOLFUNC_DAT_RATIO} -## arguments }}} - -## specify variable name outside while loop -## otherwise the inside vars invisible -XSPEC_CF_XCM="_coolfunc_calc.xcm" -[ -e "${XSPEC_CF_XCM}" ] && rm -f ${XSPEC_CF_XCM} - -## generate xspec script {{{ -cat >> ${XSPEC_CF_XCM} << _EOF_ -## XSPEC Tcl script -## calc cooling function data -## -## generated by: `basename $0` -## date: `date` - -set xs_return_results 1 -set xs_echo_script 0 -# set tcl_precision 12 -dummyrsp .01 100 4096 -## set basic data {{{ -set nh ${N_H} -set redshift ${REDSHIFT} -set abund_val ${ABUND_VAL} -set norm ${NORM} -## basic }}} - -## xspec related {{{ -# debug settings {{{ -chatter 0 -# debug }}} -query yes -abund grsa -dummyrsp 0.3 11.0 1024 -# # load model 'wabs*apec' to calc cooling function -# model wabs*apec & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -# model 'wabs*raymond' -model wabs*raymond & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -## xspec }}} - -## set input and output filename -set tpro_fn "${TPROFILE}" -set cf_fn "${COOLFUNC_DAT}" -set cff_fn "${COOLFUNC_DAT_RATIO}" -if { [ file exists \${cf_fn} ] } { - exec rm -fv \${cf_fn} -} - -if { [ file exists \${cff_fn} ] } { - exec rm -fv \${cff_fn} -} - -## open files -set tpro_fd [ open \${tpro_fn} r ] -set cf_fd [ open \${cf_fn} w ] -set cff_fd [ open \${cff_fn} w ] - -## read data from tprofile line by line -while { [ gets \${tpro_fd} tpro_line ] != -1 } { - # gets one line - scan \${tpro_line} "%f %f" radius temp_val - #puts "radius: \${radius}, temperature: \${temp_val}" - # set temperature value - newpar 2 \${temp_val} - # calc flux & tclout - flux 0.7 7.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" holder holder holder cf_data - #puts "cf_data: \${cf_data}" - puts \${cf_fd} "\${radius} \${cf_data}" - flux 0.1 2.4 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" cff_data holder holder holder - puts \${cff_fd} "\${radius} [expr \${cff_data}/\${cf_data}]" -} - -## close opened files -close \${tpro_fd} -close \${cf_fd} -close \${cff_fd} - -## exit -tclexit -_EOF_ - -## extract xcm }}} - -## invoke xspec to calc -printf "invoking XSPEC to calculate cooling function data ...\n" -# xspec - ${XSPEC_CF_XCM} -xspec - ${XSPEC_CF_XCM} > /dev/null - -## clean -# if [ -e "${XSPEC_CF_XCM}" ]; then -# rm -f ${XSPEC_CF_XCM} -# fi - -exit 0 diff --git a/mod_ly/coolfunc_0.5-2_calc.sh b/mod_ly/coolfunc_0.5-2_calc.sh deleted file mode 100755 index 889a4e3..0000000 --- a/mod_ly/coolfunc_0.5-2_calc.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh -# -# unalias -a -# -########################################################### -## Task: ## -## Calc `cooling function' data according to ## -## given `temperature profile' ## -## ## -## NOTE: ## -## given `tprofile': <radius> <temperature> ## -## calc `cooling function' by invoking `XSPEC' ## -## using model `wabs*apec' ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## August 17, 2012 ## -########################################################### - -## cmdline arguments {{{ -if [ $# -ne 5 ]; then - printf "usage:\n" - printf " `basename $0` <tprofile> <avg_abund> <nH> <redshift> <coolfunc_outfile>\n" - exit 1 -fi -base_path=`dirname $0` -TPROFILE=$1 -ABUND_VAL=$2 -N_H=$3 -REDSHIFT=$4 - -NORM=`$base_path/calc_distance $REDSHIFT|grep norm|awk '{print $2}'` -echo $NORM - -COOLFUNC_DAT=$5 -COOLFUNC_DAT_RATIO=flux_cnt_ratio.txt - -if [ ! -r "${TPROFILE}" ]; then - printf "ERROR: given tprofile '${TPROFILE}' NOT accessiable\n" - exit 2 -fi -[ -e "${COOLFUNC_DAT}" ] && rm -f ${COOLFUNC_DAT} -[ -e "${COOLFUNC_DAT_RATIO}" ] && rm -f ${COOLFUNC_DAT_RATIO} -## arguments }}} - -## specify variable name outside while loop -## otherwise the inside vars invisible -XSPEC_CF_XCM="_coolfunc_calc.xcm" -[ -e "${XSPEC_CF_XCM}" ] && rm -f ${XSPEC_CF_XCM} - -## generate xspec script {{{ -cat >> ${XSPEC_CF_XCM} << _EOF_ -## XSPEC Tcl script -## calc cooling function data -## -## generated by: `basename $0` -## date: `date` - -set xs_return_results 1 -set xs_echo_script 0 -# set tcl_precision 12 -dummyrsp .01 100 4096 -## set basic data {{{ -set nh ${N_H} -set redshift ${REDSHIFT} -set abund_val ${ABUND_VAL} -set norm ${NORM} -## basic }}} - -## xspec related {{{ -# debug settings {{{ -chatter 0 -# debug }}} -query yes -abund grsa -dummyrsp 0.3 11.0 1024 -# load model 'wabs*apec' to calc cooling function -model wabs*apec & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -## xspec }}} - -## set input and output filename -set tpro_fn "${TPROFILE}" -set cf_fn "${COOLFUNC_DAT}" -set cff_fn "${COOLFUNC_DAT_RATIO}" -if { [ file exists \${cf_fn} ] } { - exec rm -fv \${cf_fn} -} - -if { [ file exists \${cff_fn} ] } { - exec rm -fv \${cff_fn} -} - -## open files -set tpro_fd [ open \${tpro_fn} r ] -set cf_fd [ open \${cf_fn} w ] -set cff_fd [ open \${cff_fn} w ] - -## read data from tprofile line by line -while { [ gets \${tpro_fd} tpro_line ] != -1 } { - # gets one line - scan \${tpro_line} "%f %f" radius temp_val - #puts "radius: \${radius}, temperature: \${temp_val}" - # set temperature value - newpar 2 \${temp_val} - # calc flux & tclout - flux 0.7 7.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" holder holder holder cf_data - #puts "cf_data: \${cf_data}" - puts \${cf_fd} "\${radius} \${cf_data}" - flux 0.5 2.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" cff_data holder holder holder - puts \${cff_fd} "\${radius} [expr \${cff_data}/\${cf_data}]" -} - -## close opened files -close \${tpro_fd} -close \${cf_fd} -close \${cff_fd} - -## exit -tclexit -_EOF_ - -## extract xcm }}} - -## invoke xspec to calc -printf "invoking XSPEC to calculate cooling function data ...\n" -# xspec - ${XSPEC_CF_XCM} -xspec - ${XSPEC_CF_XCM} > /dev/null - -## clean -# if [ -e "${XSPEC_CF_XCM}" ]; then -# rm -f ${XSPEC_CF_XCM} -# fi - -exit 0 diff --git a/mod_ly/coolfunc_0.5-2_calc_rs.sh b/mod_ly/coolfunc_0.5-2_calc_rs.sh deleted file mode 100755 index 3d8933b..0000000 --- a/mod_ly/coolfunc_0.5-2_calc_rs.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -# -# unalias -a -# -########################################################### -## Task: ## -## Calc `cooling function' data according to ## -## given `temperature profile' ## -## ## -## NOTE: ## -## given `tprofile': <radius> <temperature> ## -## calc `cooling function' by invoking `XSPEC' ## -## using model `wabs*apec' ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## August 17, 2012 ## -########################################################### - -## cmdline arguments {{{ -if [ $# -ne 5 ]; then - printf "usage:\n" - printf " `basename $0` <tprofile> <avg_abund> <nH> <redshift> <coolfunc_outfile>\n" - exit 1 -fi -base_path=`dirname $0` -TPROFILE=$1 -ABUND_VAL=$2 -N_H=$3 -REDSHIFT=$4 - -NORM=`$base_path/calc_distance $REDSHIFT|grep norm|awk '{print $2}'` -echo $NORM - -COOLFUNC_DAT=$5 -COOLFUNC_DAT_RATIO=flux_cnt_ratio.txt - -if [ ! -r "${TPROFILE}" ]; then - printf "ERROR: given tprofile '${TPROFILE}' NOT accessiable\n" - exit 2 -fi -[ -e "${COOLFUNC_DAT}" ] && rm -f ${COOLFUNC_DAT} -[ -e "${COOLFUNC_DAT_RATIO}" ] && rm -f ${COOLFUNC_DAT_RATIO} -## arguments }}} - -## specify variable name outside while loop -## otherwise the inside vars invisible -XSPEC_CF_XCM="_coolfunc_calc.xcm" -[ -e "${XSPEC_CF_XCM}" ] && rm -f ${XSPEC_CF_XCM} - -## generate xspec script {{{ -cat >> ${XSPEC_CF_XCM} << _EOF_ -## XSPEC Tcl script -## calc cooling function data -## -## generated by: `basename $0` -## date: `date` - -set xs_return_results 1 -set xs_echo_script 0 -# set tcl_precision 12 -dummyrsp .01 100 4096 -## set basic data {{{ -set nh ${N_H} -set redshift ${REDSHIFT} -set abund_val ${ABUND_VAL} -set norm ${NORM} -## basic }}} - -## xspec related {{{ -# debug settings {{{ -chatter 0 -# debug }}} -query yes -abund grsa -dummyrsp 0.3 11.0 1024 -# # load model 'wabs*apec' to calc cooling function -# model wabs*apec & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -# model 'wabs*raymond' -model wabs*raymond & \${nh} & 1.0 & \${abund_val} & \${redshift} & \${norm} & /* -## xspec }}} - -## set input and output filename -set tpro_fn "${TPROFILE}" -set cf_fn "${COOLFUNC_DAT}" -set cff_fn "${COOLFUNC_DAT_RATIO}" -if { [ file exists \${cf_fn} ] } { - exec rm -fv \${cf_fn} -} - -if { [ file exists \${cff_fn} ] } { - exec rm -fv \${cff_fn} -} - -## open files -set tpro_fd [ open \${tpro_fn} r ] -set cf_fd [ open \${cf_fn} w ] -set cff_fd [ open \${cff_fn} w ] - -## read data from tprofile line by line -while { [ gets \${tpro_fd} tpro_line ] != -1 } { - # gets one line - scan \${tpro_line} "%f %f" radius temp_val - #puts "radius: \${radius}, temperature: \${temp_val}" - # set temperature value - newpar 2 \${temp_val} - # calc flux & tclout - flux 0.7 7.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" holder holder holder cf_data - #puts "cf_data: \${cf_data}" - puts \${cf_fd} "\${radius} \${cf_data}" - flux 0.5 2.0 - tclout flux 1 - scan \${xspec_tclout} "%f %f %f %f" cff_data holder holder holder - puts \${cff_fd} "\${radius} [expr \${cff_data}/\${cf_data}]" -} - -## close opened files -close \${tpro_fd} -close \${cf_fd} -close \${cff_fd} - -## exit -tclexit -_EOF_ - -## extract xcm }}} - -## invoke xspec to calc -printf "invoking XSPEC to calculate cooling function data ...\n" -# xspec - ${XSPEC_CF_XCM} -xspec - ${XSPEC_CF_XCM} > /dev/null - -## clean -# if [ -e "${XSPEC_CF_XCM}" ]; then -# rm -f ${XSPEC_CF_XCM} -# fi - -exit 0 diff --git a/mod_ly/extract_tcool.py b/mod_ly/extract_tcool.py deleted file mode 100755 index 05c836b..0000000 --- a/mod_ly/extract_tcool.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python - -import sys -rcool=float(sys.argv[1]) - -for l in open('cooling_time.dat'): - r,t=l.split() - r=float(r) - t=float(t) - if r>rcool: - print("cooling time at %f kpc=%f Gyr"%(rcool,t)) - print("rcool= %f kpc" % rcool) - print("cooling_time= %f Gyr @ %f kpc" % (t,rcool)) - sys.exit(0) diff --git a/mod_ly/fit_beta_nfw_mass_profile.sh b/mod_ly/fit_beta_nfw_mass_profile.sh deleted file mode 100755 index 8da6070..0000000 --- a/mod_ly/fit_beta_nfw_mass_profile.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -printf "da= ${da}\n" -printf "dl= ${dl}\n" -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp -$base_path/fit_beta_sbp $sbp_cfg 2> /dev/null -mv -fv beta_param.txt beta_param_center.txt -cat beta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -mv -fv rho_fit.dat rho_fit_center.dat -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -#exit 233 - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` -printf "rcool= ${rcool}\n" - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - $base_path/extract_tcool.py $rcool | tee cooling_time_result.txt - exit 0 -fi -## center value }}} - -# clean previous files -rm -f summary_shuffle_mass_profile.qdp -rm -f summary_overdensity.qdp -rm -f summary_mass_profile.qdp -rm -f summary_gas_mass_profile.qdp - -## count -COUNT=1 - -#100 times of Monte-carlo simulation to determine error -#just repeat above steps -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" -for i in `seq 1 100`; do - # echo $t_data_file - $base_path/shuffle_T.py $t_data_file temp_shuffled_t.dat - $base_path/shuffle_sbp.py $sbp_data_file temp_shuffled_sbp.dat - # t_data_file=temp_shuffled_t.dat -#exit - - if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model temp_shuffled_t.dat $t_param_file $cm_per_pixel - mv -f zyy_dump.qdp ${T_file} - elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 temp_shuffled_t.dat $cm_per_pixel - mv -f m0603246_dump.qdp ${T_file} - elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model temp_shuffled_t.dat $t_param_file $cm_per_pixel 2> /dev/null - mv -f wang2012_dump.qdp ${T_file} - elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model temp_shuffled_t.dat $cm_per_pixel - mv -f allen_dump.qdp ${T_file} - elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model temp_shuffled_t.dat $t_param_file - mv -f zzl_dump.qdp ${T_file} - else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 - fi - -#exit - : > temp_sbp.cfg - - cat $sbp_cfg | while read l; do - if echo $l | grep -q 'sbp_file'; then - echo "sbp_file temp_shuffled_sbp.dat" >> temp_sbp.cfg - elif echo $l | grep -q 'T_file'; then - echo "T_file ${T_file}" >> temp_sbp.cfg - else - echo $l >> temp_sbp.cfg - fi - done - - ## count - printf "## ${COUNT} ##\n" - COUNT=`expr ${COUNT} + 1` - printf "## `pwd` ##\n" - $base_path/coolfunc_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} - - # single-beta model - $base_path/fit_beta_sbp temp_sbp.cfg 2> /dev/null - [ -r "beta_param.txt" ] && cat beta_param.txt - $base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null - cat nfw_dump.qdp >> summary_mass_profile.qdp - echo "no no no" >> summary_mass_profile.qdp - - cat overdensity.qdp >> summary_overdensity.qdp - echo "no no no" >> summary_overdensity.qdp - - cat gas_mass_int.qdp >> summary_gas_mass_profile.qdp - echo "no no no" >> summary_gas_mass_profile.qdp - -done # end `while' -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" - -#analys the errors -printf "\n+++++++++++++++ RESULTS (single-beta) +++++++++++++++\n" -RESULT="results_mrl.txt" -[ -e "${RESULT}" ] && mv -fv ${RESULT} ${RESULT}_bak - -$base_path/analyze_mass_profile.py 200 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 1500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 2500 | tee -a ${RESULT} - -R200_VAL=`grep '^r200' ${RESULT} | awk '{ print $2 }'` -R500_VAL=`grep '^r500' ${RESULT} | awk '{ print $2 }'` -printf "\n## R200: ${R200_VAL}, R500: ${R500_VAL}\n" -L200=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R200_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R500_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200= ${L200} erg/s\n" | tee -a ${RESULT} -printf "L500= ${L500} erg/s\n" | tee -a ${RESULT} -$base_path/extract_tcool.py $rcool | tee cooling_time_result.txt -printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/fit_beta_nfw_mass_profile2.sh b/mod_ly/fit_beta_nfw_mass_profile2.sh deleted file mode 100755 index 87f2b12..0000000 --- a/mod_ly/fit_beta_nfw_mass_profile2.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -printf "da= ${da}\n" -printf "dl= ${dl}\n" -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp -$base_path/fit_beta_sbp2 $sbp_cfg 2> /dev/null -mv -fv beta_param.txt beta_param_center.txt -cat beta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -mv -fv rho_fit.dat rho_fit_center.dat -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -#exit 233 - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` -printf "rcool= ${rcool}\n" - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - $base_path/extract_tcool.py $rcool | tee cooling_time_result.txt - exit 0 -fi -## center value }}} - -# clean previous files -rm -f summary_shuffle_mass_profile.qdp -rm -f summary_overdensity.qdp -rm -f summary_mass_profile.qdp -rm -f summary_gas_mass_profile.qdp - -## count -COUNT=1 - -#100 times of Monte-carlo simulation to determine error -#just repeat above steps -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" -for i in `seq 1 100`; do - # echo $t_data_file - $base_path/shuffle_T.py $t_data_file temp_shuffled_t.dat - $base_path/shuffle_sbp.py $sbp_data_file temp_shuffled_sbp.dat - # t_data_file=temp_shuffled_t.dat -#exit - - if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model temp_shuffled_t.dat $t_param_file $cm_per_pixel - mv -f zyy_dump.qdp ${T_file} - elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 temp_shuffled_t.dat $cm_per_pixel - mv -f m0603246_dump.qdp ${T_file} - elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model temp_shuffled_t.dat $t_param_file $cm_per_pixel 2> /dev/null - mv -f wang2012_dump.qdp ${T_file} - elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model temp_shuffled_t.dat $cm_per_pixel - mv -f allen_dump.qdp ${T_file} - elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model temp_shuffled_t.dat $t_param_file - mv -f zzl_dump.qdp ${T_file} - else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 - fi - -#exit - : > temp_sbp.cfg - - cat $sbp_cfg | while read l; do - if echo $l | grep -q 'sbp_file'; then - echo "sbp_file temp_shuffled_sbp.dat" >> temp_sbp.cfg - elif echo $l | grep -q 'T_file'; then - echo "T_file ${T_file}" >> temp_sbp.cfg - else - echo $l >> temp_sbp.cfg - fi - done - - ## count - printf "## ${COUNT} ##\n" - COUNT=`expr ${COUNT} + 1` - printf "## `pwd` ##\n" - $base_path/coolfunc_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} - - # single-beta model - $base_path/fit_beta_sbp2 temp_sbp.cfg 2> /dev/null - [ -r "beta_param.txt" ] && cat beta_param.txt - $base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null - cat nfw_dump.qdp >> summary_mass_profile.qdp - echo "no no no" >> summary_mass_profile.qdp - - cat overdensity.qdp >> summary_overdensity.qdp - echo "no no no" >> summary_overdensity.qdp - - cat gas_mass_int.qdp >> summary_gas_mass_profile.qdp - echo "no no no" >> summary_gas_mass_profile.qdp - -done # end `while' -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" - -#analys the errors -printf "\n+++++++++++++++ RESULTS (single-beta) +++++++++++++++\n" -RESULT="results_mrl.txt" -[ -e "${RESULT}" ] && mv -fv ${RESULT} ${RESULT}_bak - -$base_path/analyze_mass_profile.py 200 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 1500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 2500 | tee -a ${RESULT} - -R200_VAL=`grep '^r200' ${RESULT} | awk '{ print $2 }'` -R500_VAL=`grep '^r500' ${RESULT} | awk '{ print $2 }'` -printf "\n## R200: ${R200_VAL}, R500: ${R500_VAL}\n" -L200=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R200_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R500_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200= ${L200} erg/s\n" | tee -a ${RESULT} -printf "L500= ${L500} erg/s\n" | tee -a ${RESULT} -$base_path/extract_tcool.py $rcool | tee cooling_time_result.txt -printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/fit_beta_nfw_mass_profile_simple.sh b/mod_ly/fit_beta_nfw_mass_profile_simple.sh deleted file mode 100755 index dc4fd3c..0000000 --- a/mod_ly/fit_beta_nfw_mass_profile_simple.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ] || [ ! -r "${radius_sbp_file}" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp -$base_path/fit_beta_sbp $sbp_cfg 2> /dev/null -mv -fv beta_param.txt beta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - exit 0 -fi -## center value }}} - -exit 0 - diff --git a/mod_ly/fit_dbeta_nfw_mass_profile.sh b/mod_ly/fit_dbeta_nfw_mass_profile.sh deleted file mode 100755 index be0404f..0000000 --- a/mod_ly/fit_dbeta_nfw_mass_profile.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -printf "da= ${da}\n" -printf "dl= ${dl}\n" -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp (double-beta) -$base_path/fit_dbeta_sbp $sbp_cfg 2> /dev/null -mv -fv dbeta_param.txt dbeta_param_center.txt -cat dbeta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -mv -fv rho_fit.dat rho_fit_center.dat -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -#exit 233 - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` -printf "rcool= ${rcool}\n" - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - $base_path/extract_tcool.py $rcool | tee cooling_time_result.txt - exit 0 -fi -## center value }}} - -# clean previous files -rm -f summary_shuffle_mass_profile.qdp -rm -f summary_overdensity.qdp -rm -f summary_mass_profile.qdp -rm -f summary_gas_mass_profile.qdp - -## count -COUNT=1 - -#100 times of Monte-carlo simulation to determine error -#just repeat above steps -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" -for i in `seq 1 100`; do - # echo $t_data_file - $base_path/shuffle_T.py $t_data_file temp_shuffled_t.dat - $base_path/shuffle_sbp.py $sbp_data_file temp_shuffled_sbp.dat - # t_data_file=temp_shuffled_t.dat -#exit - - if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model temp_shuffled_t.dat $t_param_file $cm_per_pixel - mv -f zyy_dump.qdp ${T_file} - elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 temp_shuffled_t.dat $cm_per_pixel - mv -f m0603246_dump.qdp ${T_file} - elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model temp_shuffled_t.dat $t_param_file $cm_per_pixel 2> /dev/null - mv -f wang2012_dump.qdp ${T_file} - elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model temp_shuffled_t.dat $cm_per_pixel - mv -f allen_dump.qdp ${T_file} - elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model temp_shuffled_t.dat $t_param_file - mv -f zzl_dump.qdp ${T_file} - else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 - fi - -#exit - : > temp_sbp.cfg - - cat $sbp_cfg | while read l; do - if echo $l | grep -q 'sbp_file'; then - echo "sbp_file temp_shuffled_sbp.dat" >> temp_sbp.cfg - elif echo $l | grep -q 'T_file'; then - echo "T_file ${T_file}" >> temp_sbp.cfg - else - echo $l >> temp_sbp.cfg - fi - done - - ## count - printf "## ${COUNT} ##\n" - COUNT=`expr ${COUNT} + 1` - printf "## `pwd` ##\n" - $base_path/coolfunc_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} - - # double-beta model - $base_path/fit_dbeta_sbp temp_sbp.cfg 2> /dev/null - [ -r "dbeta_param.txt" ] && cat dbeta_param.txt - $base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null - cat nfw_dump.qdp >> summary_mass_profile.qdp - echo "no no no" >> summary_mass_profile.qdp - - cat overdensity.qdp >> summary_overdensity.qdp - echo "no no no" >> summary_overdensity.qdp - - cat gas_mass_int.qdp >> summary_gas_mass_profile.qdp - echo "no no no" >> summary_gas_mass_profile.qdp - -done # end `while' -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" - -#analys the errors -printf "\n+++++++++++++++ RESULTS (double-beta) +++++++++++++++\n" -RESULT="results_dbeta_mrl.txt" -[ -e "${RESULT}" ] && mv -fv ${RESULT} ${RESULT}_bak - -$base_path/analyze_mass_profile.py 200 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 1500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 2500 | tee -a ${RESULT} - -R200_VAL=`grep '^r200' ${RESULT} | awk '{ print $2 }'` -R500_VAL=`grep '^r500' ${RESULT} | awk '{ print $2 }'` -printf "\n## R200: ${R200_VAL}, R500: ${R500_VAL}\n" -L200=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R200_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R500_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200= ${L200} erg/s\n" | tee -a ${RESULT} -printf "L500= ${L500} erg/s\n" | tee -a ${RESULT} -$base_path/extract_tcool.py $rcool | tee cooling_time_result.txt -printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/fit_dbeta_nfw_mass_profile2.sh b/mod_ly/fit_dbeta_nfw_mass_profile2.sh deleted file mode 100755 index 13a78dd..0000000 --- a/mod_ly/fit_dbeta_nfw_mass_profile2.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -printf "da= ${da}\n" -printf "dl= ${dl}\n" -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp (double-beta) -$base_path/fit_dbeta_sbp2 $sbp_cfg 2> /dev/null -mv -fv dbeta_param.txt dbeta_param_center.txt -cat dbeta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -mv -fv rho_fit.dat rho_fit_center.dat -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -#exit 233 - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` -printf "rcool= ${rcool}\n" - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - $base_path/extract_tcool.py $rcool | tee cooling_time_result.txt - exit 0 -fi -## center value }}} - -# clean previous files -rm -f summary_shuffle_mass_profile.qdp -rm -f summary_overdensity.qdp -rm -f summary_mass_profile.qdp -rm -f summary_gas_mass_profile.qdp - -## count -COUNT=1 - -#100 times of Monte-carlo simulation to determine error -#just repeat above steps -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" -for i in `seq 1 100`; do - # echo $t_data_file - $base_path/shuffle_T.py $t_data_file temp_shuffled_t.dat - $base_path/shuffle_sbp.py $sbp_data_file temp_shuffled_sbp.dat - # t_data_file=temp_shuffled_t.dat -#exit - - if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model temp_shuffled_t.dat $t_param_file $cm_per_pixel - mv -f zyy_dump.qdp ${T_file} - elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 temp_shuffled_t.dat $cm_per_pixel - mv -f m0603246_dump.qdp ${T_file} - elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model temp_shuffled_t.dat $t_param_file $cm_per_pixel 2> /dev/null - mv -f wang2012_dump.qdp ${T_file} - elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model temp_shuffled_t.dat $cm_per_pixel - mv -f allen_dump.qdp ${T_file} - elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model temp_shuffled_t.dat $t_param_file - mv -f zzl_dump.qdp ${T_file} - else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 - fi - -#exit - : > temp_sbp.cfg - - cat $sbp_cfg | while read l; do - if echo $l | grep -q 'sbp_file'; then - echo "sbp_file temp_shuffled_sbp.dat" >> temp_sbp.cfg - elif echo $l | grep -q 'T_file'; then - echo "T_file ${T_file}" >> temp_sbp.cfg - else - echo $l >> temp_sbp.cfg - fi - done - - ## count - printf "## ${COUNT} ##\n" - COUNT=`expr ${COUNT} + 1` - printf "## `pwd` ##\n" - $base_path/coolfunc_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} - - # double-beta model - $base_path/fit_dbeta_sbp2 temp_sbp.cfg 2> /dev/null - [ -r "dbeta_param.txt" ] && cat dbeta_param.txt - $base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null - cat nfw_dump.qdp >> summary_mass_profile.qdp - echo "no no no" >> summary_mass_profile.qdp - - cat overdensity.qdp >> summary_overdensity.qdp - echo "no no no" >> summary_overdensity.qdp - - cat gas_mass_int.qdp >> summary_gas_mass_profile.qdp - echo "no no no" >> summary_gas_mass_profile.qdp - -done # end `while' -printf "\n+++++++++++++++++++ Monte Carlo +++++++++++++++++++++\n" - -#analys the errors -printf "\n+++++++++++++++ RESULTS (double-beta) +++++++++++++++\n" -RESULT="results_dbeta_mrl.txt" -[ -e "${RESULT}" ] && mv -fv ${RESULT} ${RESULT}_bak - -$base_path/analyze_mass_profile.py 200 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 1500 | tee -a ${RESULT} -$base_path/analyze_mass_profile.py 2500 | tee -a ${RESULT} - -R200_VAL=`grep '^r200' ${RESULT} | awk '{ print $2 }'` -R500_VAL=`grep '^r500' ${RESULT} | awk '{ print $2 }'` -printf "\n## R200: ${R200_VAL}, R500: ${R500_VAL}\n" -L200=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R200_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500=`$base_path/calc_lx $radius_sbp_file flux_cnt_ratio_center.txt $z ${R500_VAL} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200= ${L200} erg/s\n" | tee -a ${RESULT} -printf "L500= ${L500} erg/s\n" | tee -a ${RESULT} -$base_path/extract_tcool.py $rcool | tee cooling_time_result.txt -printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/fit_dbeta_nfw_mass_profile_simple.sh b/mod_ly/fit_dbeta_nfw_mass_profile_simple.sh deleted file mode 100755 index 44999e3..0000000 --- a/mod_ly/fit_dbeta_nfw_mass_profile_simple.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh - -# modified by LIweitaNux, 2012/09/06 -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -eq 1 ]; then - cfg_file="$1" -elif [ $# -eq 2 ]; then - cfg_file="$1" - CENTER_VAL="YES" -else - echo "Usage: $0 <cfg_file> [c]" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -printf "## use configuration file: \`${cfg_file}'\n" - -#initialize profile type name -t_profile_type=`grep '^t_profile' $cfg_file | awk '{print $2}'` -printf "## t_profile_type: \`$t_profile_type'\n" -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -# cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -da=`python -c "print($cm_per_pixel/(.492/3600/180*3.1415926))"` -dl=`python -c "print($da*(1+$z)**2)"` -## sbp {{{ -sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -# mv -f _tmp_rsbp.txt ${radius_sbp_file} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -# determine which temperature profile to be used, and fit the T profile {{{ -if [ "$t_profile_type" = "zyy" ]; then - $base_path/fit_zyy_model $t_data_file $t_param_file $cm_per_pixel - # mv -f zyy_dump.qdp ${T_file} - mv -f zyy_dump.qdp zyy_dump_center.qdp -elif [ "$t_profile_type" = "m0603246" ]; then - $base_path/fit_m0603246 $t_data_file $cm_per_pixel - # mv -f m0603246_dump.qdp ${T_file} - mv -f m0603246_dump.qdp m0603246_dump_center.qdp -elif [ "$t_profile_type" = "wang2012" ]; then - $base_path/fit_wang2012_model $t_data_file $t_param_file $cm_per_pixel 2> /dev/null | tee wang2012_center_param.txt - # mv -f wang2012_dump.qdp ${T_file} - cp -fv wang2012_dump.qdp ${T_file} - T_file_center="wang2012_dump_center.qdp" - mv -fv wang2012_dump.qdp ${T_file_center} - mv -fv fit_result.qdp wang2012_fit_center.qdp -elif [ "$t_profile_type" = "allen" ]; then - $base_path/fit_allen_model $t_data_file $cm_per_pixel - # mv -f allen_dump.qdp ${T_file} - mv -f allen_dump.qdp allen_dump_center.qdp -elif [ "$t_profile_type" = "zzl" ]; then - $base_path/fit_zzl_model $t_data_file $t_param_file - # mv -f zzl_dump.qdp ${T_file} - mv -f zzl_dump.qdp zzl_dump_center.qdp -else - printf "ERROR: temperature profile name \`${t_profile_type}' invalid!\n" - exit 10 -fi -# temp profile }}} - -$base_path/coolfunc_calc_bolo.sh ${T_file_center} $abund $nh $z cfunc_bolo.dat -$base_path/coolfunc_calc.sh ${T_file_center} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_cnt_ratio_center.txt -# fit sbp (double-beta) -$base_path/fit_dbeta_sbp $sbp_cfg 2> /dev/null -mv -fv dbeta_param.txt dbeta_param_center.txt -mv -fv sbp_fit.qdp sbp_fit_center.qdp -mv -fv rho_fit.qdp rho_fit_center.qdp -$base_path/fit_nfw_mass mass_int.dat $z 2> /dev/null -mv -fv nfw_param.txt nfw_param_center.txt -mv -fv nfw_fit_result.qdp nfw_fit_center.qdp -mv -fv nfw_dump.qdp mass_int_center.qdp -mv -fv overdensity.qdp overdensity_center.qdp -mv -fv gas_mass_int.qdp gas_mass_int_center.qdp - -## cooling time -$base_path/cooling_time rho_fit_center.dat ${T_file_center} cfunc_bolo.dat $dl $cm_per_pixel > cooling_time.dat -## radius to calculate tcool, not the cooling time! -rcool=`$base_path/analyze_mass_profile.py 500 c | grep '^r500' | awk -F "=" '{print .048*$2}'` - -## center value {{{ -if [ "${CENTER_VAL}" = "YES" ]; then - $base_path/analyze_mass_profile.py 200 c - $base_path/analyze_mass_profile.py 500 c - exit 0 -fi -## center value }}} - -exit 0 - diff --git a/mod_ly/luminosity_0.1-2.4.sh b/mod_ly/luminosity_0.1-2.4.sh deleted file mode 100755 index 91c94c1..0000000 --- a/mod_ly/luminosity_0.1-2.4.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 1 ]; then - echo "Usage: $0 <cfg_file>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -printf "## use configuration file: \`${cfg_file}'\n" - -read -p "R200:" R200 -read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio_center.txt - -L200_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.1-2.4= ${L200_flux0124} erg/s\n" -printf "L500_0.1-2.4= ${L500_flux0124} erg/s\n" - diff --git a/mod_ly/luminosity_0.1-2.4_check.sh b/mod_ly/luminosity_0.1-2.4_check.sh deleted file mode 100755 index 6614446..0000000 --- a/mod_ly/luminosity_0.1-2.4_check.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 3 ]; then - echo "Usage: $0 <cfg_file> <R200> <R500>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -#printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -#printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -#printf "## use configuration file: \`${cfg_file}'\n" -R200=$2 -R500=$3 - -# read -p "R200:" R200 -# read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -# abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -read -p "> abund: " abund -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -# printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -[ -e "flux_cnt_ratio.txt" ] && mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -[ -e "flux_cnt_ratio_center.txt" ] && mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio_center.txt - -L200_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.1-2.4= ${L200_flux0124} erg/s\n" -printf "L500_0.1-2.4= ${L500_flux0124} erg/s\n" - diff --git a/mod_ly/luminosity_0.1-2.4_lwt.sh b/mod_ly/luminosity_0.1-2.4_lwt.sh deleted file mode 100755 index 125bfc7..0000000 --- a/mod_ly/luminosity_0.1-2.4_lwt.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 3 ]; then - echo "Usage: $0 <cfg_file> <R200> <R500>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -#printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -#printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -#printf "## use configuration file: \`${cfg_file}'\n" -R200=$2 -R500=$3 - -# read -p "R200:" R200 -# read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -# printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -[ -e "flux_cnt_ratio.txt" ] && mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -[ -e "flux_cnt_ratio_center.txt" ] && mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio_center.txt - -L200_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.1-2.4= ${L200_flux0124} erg/s\n" -printf "L500_0.1-2.4= ${L500_flux0124} erg/s\n" - diff --git a/mod_ly/luminosity_0.1-2.4_lwt_rs.sh b/mod_ly/luminosity_0.1-2.4_lwt_rs.sh deleted file mode 100755 index 2e4d7cf..0000000 --- a/mod_ly/luminosity_0.1-2.4_lwt_rs.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 3 ]; then - echo "Usage: $0 <cfg_file> <R200> <R500>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -#printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -#printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -#printf "## use configuration file: \`${cfg_file}'\n" -R200=$2 -R500=$3 - -# read -p "R200:" R200 -# read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -# printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -[ -e "flux_cnt_ratio.txt" ] && mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -[ -e "flux_cnt_ratio_center.txt" ] && mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc_rs.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio_center.txt - -L200_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.1-2.4= ${L200_flux0124} erg/s\n" -printf "L500_0.1-2.4= ${L500_flux0124} erg/s\n" - diff --git a/mod_ly/luminosity_0.1-2.4_orig.sh b/mod_ly/luminosity_0.1-2.4_orig.sh deleted file mode 100755 index 531a2b1..0000000 --- a/mod_ly/luminosity_0.1-2.4_orig.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 1 ]; then - echo "Usage: $0 <cfg_file>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -printf "## use configuration file: \`${cfg_file}'\n" - -read -p "R200:" R200 -read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio_center.txt - -$base_path/coolfunc_0.1-2.4_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} -mv -fv flux_cnt_ratio.txt flux_0.1-2.4_cnt_ratio.txt - -RESULT="$HOME/data_tot/luminosity.txt" - -L200_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0124=`$base_path/calc_lx $radius_sbp_file flux_0.1-2.4_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "`pwd -P` : \n" | tee -a ${RESULT} -printf "L200_0.1-2.4= ${L200_flux0124} erg/s\n" | tee -a ${RESULT} -printf "L500_0.1-2.4= ${L500_flux0124} erg/s\n" | tee -a ${RESULT} diff --git a/mod_ly/luminosity_0.5-2.sh b/mod_ly/luminosity_0.5-2.sh deleted file mode 100755 index f3ed643..0000000 --- a/mod_ly/luminosity_0.5-2.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 1 ]; then - echo "Usage: $0 <cfg_file>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -printf "## use configuration file: \`${cfg_file}'\n" - -read -p "R200:" R200 -read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.5-2_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.5-2_cnt_ratio_center.txt - -L200_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.5-2= ${L200_flux0520} erg/s\n" -printf "L500_0.5-2= ${L500_flux0520} erg/s\n" - diff --git a/mod_ly/luminosity_0.5-2_lwt.sh b/mod_ly/luminosity_0.5-2_lwt.sh deleted file mode 100755 index 8fe5f44..0000000 --- a/mod_ly/luminosity_0.5-2_lwt.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 3 ]; then - echo "Usage: $0 <cfg_file> <R200> <R500>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -#printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -#printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -#printf "## use configuration file: \`${cfg_file}'\n" -R200=$2 -R500=$3 - -#read -p "R200:" R200 -#read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -#printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -[ -e "flux_cnt_ratio.txt" ] && mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -[ -e "flux_cnt_ratio_center.txt" ] && mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.5-2_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.5-2_cnt_ratio_center.txt - -L200_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.5-2= ${L200_flux0520} erg/s\n" -printf "L500_0.5-2= ${L500_flux0520} erg/s\n" - diff --git a/mod_ly/luminosity_0.5-2_lwt_rs.sh b/mod_ly/luminosity_0.5-2_lwt_rs.sh deleted file mode 100755 index 5019013..0000000 --- a/mod_ly/luminosity_0.5-2_lwt_rs.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 3 ]; then - echo "Usage: $0 <cfg_file> <R200> <R500>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -#printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -#printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -#printf "## use configuration file: \`${cfg_file}'\n" -R200=$2 -R500=$3 - -#read -p "R200:" R200 -#read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -#printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` -if [ "x$radius_sbp_file" = "x" ]; then - echo "ERROR, must have radius_sbp_file assigned, this file should be a 4-column file, which contains the radius, radius err, sbp, and sbp err" - exit 200 -fi - -TMP_RSBP="_tmp_rsbp.txt" -[ -e "${TMP_RSBP}" ] && rm -f ${TMP_RSBP} -cat ${radius_sbp_file} | sed 's/#.*$//' | grep -Ev '^\s*$' > ${TMP_RSBP} -radius_sbp_file="${TMP_RSBP}" -## sbp }}} - -[ -e "flux_cnt_ratio.txt" ] && mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -[ -e "flux_cnt_ratio_center.txt" ] && mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.5-2_calc_rs.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.5-2_cnt_ratio_center.txt - -L200_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "L200_0.5-2= ${L200_flux0520} erg/s\n" -printf "L500_0.5-2= ${L500_flux0520} erg/s\n" - diff --git a/mod_ly/luminosity_0.5-2_orig.sh b/mod_ly/luminosity_0.5-2_orig.sh deleted file mode 100755 index 228d2c0..0000000 --- a/mod_ly/luminosity_0.5-2_orig.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" - -if [ $# -ne 1 ]; then - echo "Usage: $0 <cfg_file>" - exit 1 -fi - -if ! which xspec > /dev/null; then - printf "ERROR: please initialize HEASOFT first\n" - exit 2 -fi - -if [ -z "${HEADAS}" ]; then - printf "ERROR: variable \`HEADAS' not properly set\n" - exit 3 -fi - -export PGPLOT_FONT="${HEADAS}/lib/grfont.dat" -printf "## PGPLOT_FONT: \`${PGPLOT_FONT}'\n" - -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -printf "## base_path: \`${base_path}'\n" -cfg_file="$1" -printf "## use configuration file: \`${cfg_file}'\n" - -read -p "R200:" R200 -read -p "R500:" R500 - -#initialize data file name -t_data_file=`grep '^t_data_file' $cfg_file | awk '{print $2}'` -#t_param_file=`grep '^t_param_file' $cfg_file | awk '{print $2}'` -#initialize sbp config file -sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{print $2}'` -#initialize the temperature profile file -T_file=`grep '^T_file' $sbp_cfg | awk '{print $2}'` -cfunc_file=`grep '^cfunc_file' ${sbp_cfg} |awk '{print $2}'` -abund=`grep '^abund' ${cfg_file} |awk '{print $2}'` -nh=`grep '^nh' ${cfg_file} |awk '{print $2}'` -## calc `cm_per_pixel' instead {{{ -cm_per_pixel=`grep '^cm_per_pixel' $sbp_cfg|awk '{print $2}'` -z=`grep '^z' $sbp_cfg | awk '{ print $2 }'` -cm_per_pixel=`${base_path}/calc_distance ${z} | grep 'cm_per_pixel' | awk '{ print $2 }'` -sed -i'' "s/^cm_per_pixel.*$/cm_per_pixel ${cm_per_pixel}/" ${sbp_cfg} -printf "## redshift: ${z}, cm_per_pixel: ${cm_per_pixel}\n" -## cm_per_pixel }}} -## sbp {{{ -#sbp_data_file=`grep '^sbp_file' $sbp_cfg | awk '{print $2}'` -radius_sbp_file=`grep '^radius_sbp_file' ${cfg_file} | awk '{print $2}'` - -mv -fv flux_cnt_ratio.txt flux_bolo_cnt_ratio.txt -mv -fv flux_cnt_ratio_center.txt flux_bolo_cnt_ratio_center.txt - -$base_path/coolfunc_0.5-2_calc.sh ${T_file} $abund $nh $z $cfunc_file -mv -fv flux_cnt_ratio.txt flux_0.5-2_cnt_ratio_center.txt - -$base_path/coolfunc_0.5-2_calc.sh ${T_file} ${abund} ${nh} ${z} ${cfunc_file} -mv -fv flux_cnt_ratio.txt flux_0.5-2_cnt_ratio.txt - -RESULT="$HOME/data_tot/luminosity.txt" - -L200_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R200} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -L500_flux0520=`$base_path/calc_lx $radius_sbp_file flux_0.5-2_cnt_ratio_center.txt $z ${R500} $t_data_file | grep '^Lx' | awk '{ print $2,$3,$4 }'` -printf "`pwd -P` : \n" | tee -a ${RESULT} -printf "L200_0.5-2= ${L200_flux0520} erg/s\n" | tee -a ${RESULT} -printf "L500_0.5-2= ${L500_flux0520} erg/s\n" | tee -a ${RESULT} diff --git a/mod_ly/lx_simple_gxy.sh b/mod_ly/lx_simple_gxy.sh deleted file mode 100755 index 7ce581a..0000000 --- a/mod_ly/lx_simple_gxy.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# -unalias -a -export LC_COLLATE=C -# fix path for python -export PATH="/usr/bin:$PATH" -########################################################### -## calc lx, based on `calc_lx', modified for gxy ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## November 3, 2012 ## -########################################################### - -## usage, `path_conffile' is the configuration file -## which contains the `path' to each `repro/mass' directory -if [ $# -eq 1 ]; then - # process dir - MDIR="$1" -elif [ $# -eq 2 ]; then - # process dir - MDIR="$1" - # separate log file - MAIN_LOG="`pwd -P`/`basename $2`" -else - printf "usage:\n" - printf " `basename $0` <mass_dir> [ <logfile> ]\n" - printf "\nNOTE:\n" - printf " script cannot handle \`~' in path\n" - exit 1 -fi - -if [ ! -d "${MDIR}" ]; then - printf "## ERROR: given \`${MDIR}' not a directory\n" - exit 2 -fi -if [ -d "${MAIN_LOG}" ]; then - printf "## ERROR: given \`${MAIN_LOG}' IS a file\n" - exit 3 -fi - -## set the path to the script {{{ -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -LX1_SCRIPT="$base_path/luminosity_0.1-2.4_lwt.sh" -LX2_SCRIPT="$base_path/luminosity_0.5-2_lwt.sh" -if [ ! -e "${LX1_SCRIPT}" ] || [ ! -e "${LX2_SCRIPT}" ]; then - printf "ERROR: \`LX_SCRIPT' not exist\n" - exit 250 -fi -## script path }}} - -# result lines -RES_LINE=100 - -# process -cd ${MDIR} -printf "Entered dir: \``pwd`'\n" -# mass fitting conf -MCONF="`ls fitting_mass.conf global.cfg 2> /dev/null | head -n 1`" -if [ ! -r "${MCONF}" ]; then - printf "ERROR: main configuration file not accessiable\n" - exit 10 -else - printf "## use main configuration file: \`${MCONF}'\n" - LOGFILE="lx_gxy_`date '+%Y%m%d%H'`.log" - [ -e "${LOGFILE}" ] && mv -fv ${LOGFILE} ${LOGFILE}_bak - TOLOG="tee -a ${LOGFILE}" - printf "## use logfile: \`${LOGFILE}'\n" - if [ ! -z "${MAIN_LOG}" ]; then - printf "## separate main logfile: \`${MAIN_LOG}'\n" - fi - printf "## working directory: \``pwd -P`'\n" | ${TOLOG} - printf "## use configuration files: \`${MCONF}'\n" | ${TOLOG} - # fitting_mass logfile, get R500 from it - MLOG=`ls ${MCONF%.[confgCONFG]*}*.log | tail -n 1` - if [ ! -r "${MLOG}" ]; then - printf "## ERROR: mass log file not accessiable\n" - exit 20 - fi - R500_VAL=`tail -n ${RES_LINE} ${MLOG} | grep '^r500' | head -n 1 | awk '{ print $2 }'` - R200_VAL=`tail -n ${RES_LINE} ${MLOG} | grep '^r200' | head -n 1 | awk '{ print $2 }'` - if [ -z "${R500_VAL}" ] || [ -z "${R200_VAL}" ]; then - printf "## ERROR: cannot get R500 or R200\n" - exit 30 - fi - printf "## R200 (kpc): \`${R200_VAL}'\n" | ${TOLOG} - printf "## R500 (kpc): \`${R500_VAL}'\n" | ${TOLOG} - printf "## CMD: ${LX1_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL}\n" | ${TOLOG} -# printf "## CMD: ${LX2_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL}\n" | ${TOLOG} - sh ${LX1_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL} | ${TOLOG} -# sh ${LX2_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL} | ${TOLOG} - ## append results to main log file - if [ ! -z "${MAIN_LOG}" ]; then - printf "\n" >> ${MAIN_LOG} - printf "`pwd -P`\n" >> ${MAIN_LOG} - grep '^L[25]00' ${LOGFILE} >> ${MAIN_LOG} - fi -fi -printf "\n++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/lx_simple_gxy_rs.sh b/mod_ly/lx_simple_gxy_rs.sh deleted file mode 100755 index e424f4c..0000000 --- a/mod_ly/lx_simple_gxy_rs.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# -unalias -a -export LC_COLLATE=C -# fix path for python -export PATH="/usr/bin:$PATH" -########################################################### -## calc lx, based on `calc_lx', modified for gxy ## -## ## -## LIweitiaNux <liweitianux@gmail.com> ## -## November 3, 2012 ## -########################################################### - -## usage, `path_conffile' is the configuration file -## which contains the `path' to each `repro/mass' directory -if [ $# -eq 1 ]; then - # process dir - MDIR="$1" -elif [ $# -eq 2 ]; then - # process dir - MDIR="$1" - # separate log file - MAIN_LOG="`pwd -P`/`basename $2`" -else - printf "usage:\n" - printf " `basename $0` <mass_dir> [ <logfile> ]\n" - printf "\nNOTE:\n" - printf " script cannot handle \`~' in path\n" - exit 1 -fi - -if [ ! -d "${MDIR}" ]; then - printf "## ERROR: given \`${MDIR}' not a directory\n" - exit 2 -fi -if [ -d "${MAIN_LOG}" ]; then - printf "## ERROR: given \`${MAIN_LOG}' IS a file\n" - exit 3 -fi - -## set the path to the script {{{ -if [ "$0" = `basename $0` ]; then - script_path=`which $0` - base_path=`dirname ${script_path}` -else - base_path=`dirname $0` -fi -LX1_SCRIPT="$base_path/luminosity_0.1-2.4_lwt_rs.sh" -LX2_SCRIPT="$base_path/luminosity_0.5-2_lwt_rs.sh" -if [ ! -e "${LX1_SCRIPT}" ] || [ ! -e "${LX2_SCRIPT}" ]; then - printf "ERROR: \`LX_SCRIPT' not exist\n" - exit 250 -fi -## script path }}} - -# result lines -RES_LINE=100 - -# process -cd ${MDIR} -printf "Entered dir: \``pwd`'\n" -# mass fitting conf -MCONF="`ls fitting_mass.conf global.cfg 2> /dev/null | head -n 1`" -if [ ! -r "${MCONF}" ]; then - printf "ERROR: main configuration file not accessiable\n" - exit 10 -else - printf "## use main configuration file: \`${MCONF}'\n" - LOGFILE="lx_gxy_`date '+%Y%m%d%H'`.log" - [ -e "${LOGFILE}" ] && mv -fv ${LOGFILE} ${LOGFILE}_bak - TOLOG="tee -a ${LOGFILE}" - printf "## use logfile: \`${LOGFILE}'\n" - if [ ! -z "${MAIN_LOG}" ]; then - printf "## separate main logfile: \`${MAIN_LOG}'\n" - fi - printf "## working directory: \``pwd -P`'\n" | ${TOLOG} - printf "## use configuration files: \`${MCONF}'\n" | ${TOLOG} - # fitting_mass logfile, get R500 from it - MLOG=`ls ${MCONF%.[confgCONFG]*}*.log | tail -n 1` - if [ ! -r "${MLOG}" ]; then - printf "## ERROR: mass log file not accessiable\n" - exit 20 - fi - R500_VAL=`tail -n ${RES_LINE} ${MLOG} | grep '^r500' | head -n 1 | awk '{ print $2 }'` - R200_VAL=`tail -n ${RES_LINE} ${MLOG} | grep '^r200' | head -n 1 | awk '{ print $2 }'` - if [ -z "${R500_VAL}" ] || [ -z "${R200_VAL}" ]; then - printf "## ERROR: cannot get R500 or R200\n" - exit 30 - fi - printf "## R200 (kpc): \`${R200_VAL}'\n" | ${TOLOG} - printf "## R500 (kpc): \`${R500_VAL}'\n" | ${TOLOG} - printf "## CMD: ${LX1_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL}\n" | ${TOLOG} -# printf "## CMD: ${LX2_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL}\n" | ${TOLOG} - sh ${LX1_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL} | ${TOLOG} -# sh ${LX2_SCRIPT} ${MCONF} ${R200_VAL} ${R500_VAL} | ${TOLOG} - ## append results to main log file - if [ ! -z "${MAIN_LOG}" ]; then - printf "\n" >> ${MAIN_LOG} - printf "`pwd -P`\n" >> ${MAIN_LOG} - grep '^L[25]00' ${LOGFILE} >> ${MAIN_LOG} - fi -fi -printf "\n++++++++++++++++++++++++++++++++++++++\n" - diff --git a/mod_ly/shuffle_T.py b/mod_ly/shuffle_T.py deleted file mode 100755 index 24e7393..0000000 --- a/mod_ly/shuffle_T.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/python - -import sys -import scipy - -output_file=open(sys.argv[2],'w') -for i in open(sys.argv[1]): - r,re,c,s=i.strip().split() - c=float(c) - s=float(s) - - if c>0 and s>0: - c1=-1 - while c1<=0: - c1=scipy.random.normal(0,1)*s+c - - output_file.write("%s\t%s\t%s\t%s\n"%(r,re,c1,s)) - diff --git a/mod_ly/shuffle_sbp.py b/mod_ly/shuffle_sbp.py deleted file mode 100755 index 210bfb8..0000000 --- a/mod_ly/shuffle_sbp.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/python - -import sys -import scipy - -output_file=open(sys.argv[2],'w') -for i in open(sys.argv[1]): - c,s=i.strip().split() - c=float(c) - s=float(s) - - if c>0 and s>0: - c1=-1 - while c1<=0: - c1=scipy.random.normal(0,1)*s+c - - output_file.write("%s\t%s\n"%(c1,s)) - |