aboutsummaryrefslogtreecommitdiffstats
path: root/mass_profile/calc_lxfx_simple.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-05-27 22:47:24 +0800
committerAaron LI <aaronly.me@gmail.com>2016-05-27 22:47:24 +0800
commitffd178e0bd72562a3c2cff9747b6e656edc881dc (patch)
tree8800b7b5b2e8bc3df1a6760df5cd54eaaa686702 /mass_profile/calc_lxfx_simple.sh
parent5c35fad9240fb42c1371c721e0b2af7379bd9ea0 (diff)
downloadchandra-acis-analysis-ffd178e0bd72562a3c2cff9747b6e656edc881dc.tar.bz2
Add mass_profile tools
* These tools are mainly use to calculate the total gravitational mass profile, as well as the intermediate products (e.g., surface brightness profile fitting, gas density profile, NFW fitting, etc.) * There are additional tools for calculating the luminosity and flux. * These tools mainly developed by Junhua GU, and contributed by Weitian (Aaron) LI, and Zhenghao ZHU.
Diffstat (limited to 'mass_profile/calc_lxfx_simple.sh')
-rwxr-xr-xmass_profile/calc_lxfx_simple.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/mass_profile/calc_lxfx_simple.sh b/mass_profile/calc_lxfx_simple.sh
new file mode 100755
index 0000000..4b6d632
--- /dev/null
+++ b/mass_profile/calc_lxfx_simple.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+###########################################################
+# to calculate the Lx Fx data
+# based on 'loop_lx.sh', but to calculate one src per time
+#
+# LIweitiaNux
+# 2013/10/30
+###########################################################
+
+
+full_path=`readlink -f $0`
+base_dir=`dirname $full_path`
+
+if [ $# -lt 2 ]; then
+ printf "usage:\n"
+ printf " `basename $0` <global.cfg> [c] < 500 | 200 > ...\n"
+ exit 1
+fi
+
+cfg_file="$1"
+pre_results="final_result.txt"
+
+case "$2" in
+ [cC]*)
+ F_C="YES"
+ shift
+ ;;
+ *)
+ F_C="NO"
+ ;;
+esac
+
+shift
+echo "delta: $@" # 'printf' not work
+
+if [ "${F_C}" = "YES" ]; then
+ printf "MODE: center\n"
+fi
+
+# exit
+
+if [ ! -r "${cfg_file}" ]; then
+ printf "ERROR: global cfg not accessible\n"
+elif [ ! -r "${pre_results}" ]; then
+ printf "ERROR: previous '${pre_results}' not accessible\n"
+else
+ sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{ print $2 }'`
+ ##
+ for delta in $@; do
+ if grep -q '^beta2' $sbp_cfg; then
+ MODEL="dbeta"
+ else
+ MODEL="beta"
+ fi
+ rout=`grep "^r${delta}" ${pre_results} | sed -e 's/=/ /' | awk '{ print $2 }'`
+ if [ "${F_C}" = "YES" ]; then
+ lx_res="lx_result_${delta}_c.txt"
+ fx_res="fx_result_${delta}_c.txt"
+ CMD="$base_dir/calc_lx_${MODEL}.sh $cfg_file $rout c"
+ else
+ lx_res="lx_result_${delta}.txt"
+ fx_res="fx_result_${delta}.txt"
+ CMD="$base_dir/calc_lx_${MODEL}.sh $cfg_file $rout"
+ fi
+ [ -e "${lx_res}" ] && mv -f ${lx_res} ${lx_res}_bak
+ [ -e "${fx_res}" ] && mv -f ${fx_res} ${fx_res}_bak
+ ${CMD}
+ mv -f lx_result.txt ${lx_res}
+ mv -f fx_result.txt ${fx_res}
+ done
+fi
+
+exit 0
+