aboutsummaryrefslogtreecommitdiffstats
path: root/mod_ly/luminosity_0.1-2.4_check.sh
diff options
context:
space:
mode:
authorWeitian LI <liweitianux@gmail.com>2014-06-18 22:20:59 +0800
committerWeitian LI <liweitianux@gmail.com>2014-06-18 22:20:59 +0800
commite3923265d0d6949407a83726e9a9bd5d97079221 (patch)
tree9afd8520595f4cf80815b9bccfc3dcf2879ebe47 /mod_ly/luminosity_0.1-2.4_check.sh
downloadchandra-acis-analysis-e3923265d0d6949407a83726e9a9bd5d97079221.tar.bz2
Initial commit
Added files: * mass_profile: developed by Junhua GU, modified by Weitian LI * opt_utilities: developed by Junhua GU * tools/cosmo_calc: originated from 'calc_distance', modified * scripts: scripts used to process Chandra ACIS data * files: useful files used in processing * HOWTO_chandra_acis_process.txt * README.md
Diffstat (limited to 'mod_ly/luminosity_0.1-2.4_check.sh')
-rwxr-xr-xmod_ly/luminosity_0.1-2.4_check.sh80
1 files changed, 80 insertions, 0 deletions
diff --git a/mod_ly/luminosity_0.1-2.4_check.sh b/mod_ly/luminosity_0.1-2.4_check.sh
new file mode 100755
index 0000000..6614446
--- /dev/null
+++ b/mod_ly/luminosity_0.1-2.4_check.sh
@@ -0,0 +1,80 @@
+#!/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"
+