diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-06-08 22:24:49 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-06-08 22:24:49 +0800 |
commit | b635a7644529edbfd7e53410c9e98b255ecd1f7c (patch) | |
tree | 113f67c4e612d119247d4b2857b2b098bb27e2a5 /scripts | |
parent | e37c76a05d800fb71ec4a910935b18a346152227 (diff) | |
download | chandra-acis-analysis-b635a7644529edbfd7e53410c9e98b255ecd1f7c.tar.bz2 |
Drop calc_distance support in favor of cosmo_calc
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ciao_calc_ct.sh | 46 | ||||
-rwxr-xr-x | scripts/ciao_r500avgt.sh | 73 |
2 files changed, 39 insertions, 80 deletions
diff --git a/scripts/ciao_calc_ct.sh b/scripts/ciao_calc_ct.sh index 58bf566..2a277e9 100755 --- a/scripts/ciao_calc_ct.sh +++ b/scripts/ciao_calc_ct.sh @@ -1,31 +1,24 @@ #!/bin/sh # -unalias -a -export LC_COLLATE=C -########################################################### -## based on `ciao_r500avgt.sh' ## -## for calculating the `cooling time' ## -## within (0.-0.048 r500) region ## -## ## -## Author: Junhua GU ## -## Created: 2012/08/22 ## -## ## -## Modified by: Weitian LI ## -## 2013/04/28 ## -########################################################### +## Calculate the cooling time within the (0.-0.048 r500) region. +## Based on `ciao_r500avgt.sh' ## -VERSION="v2.0" -UPDATE="2015/06/03" +## Junhua GU +## Created: 2012-08-22 +## Weitian LI +## Updated: 2016-06-08 ## -## Changelogs: -## v2.0, 2015/06/03, Aaron LI +## Change logs: +## 2016-06-08, Weitian LI +## * Drop 'calc_distance' in favor of 'cosmo_calc' +## v2.0, 2015/06/03, Weitian LI ## * Copy needed pfiles to current working directory, and ## set environment variable $PFILES to use these first. ## * Replace 'grep' with '\grep', 'ls' with '\ls' ## * replaced 'grppha' with 'dmgroup' to group spectra ## (dmgroup will add history to fits file, while grppha NOT) ## * ds9 colormap changed from 'sls' to 'he' -## v1.2, 2015/05/27, Aaron LI +## v1.2, 2015/05/27, Weitian LI ## update 'DFT_ARF' & 'DFT_RMF' to find '*.arf' & '*.rmf' files ## (specextract only use .arf & .rmf extensions since revision 2014-12) ## v1.1, 2014/06/18 @@ -54,23 +47,11 @@ case "$1" in -[hH]*|--[hH]*) printf "usage:\n" printf " `basename $0` basedir=<repro_dir> evt=<evt2_clean> r500=<r500_kpc> regin=<input_reg> regout=<output_reg> bkgd=<blank_evt | lbkg_reg | bkg_spec> nh=<nH> z=<redshift> arf=<arf_file> rmf=<rmf_file> [ grouptype=<NUM_CTS|BIN> grouptypeval=<number> binspec=<binspec> log=<log_file> ]\n" - printf "\nversion:\n" - printf " ${VERSION}, ${UPDATED}\n" exit ${ERR_USG} ;; esac ## usage, help }}} -## comology calculator {{{ -## NOTES: use `$HOME' instead of `~' in path -BASE_PATH=`dirname $0` -COSCALC="`which cosmo_calc calc_distance 2>/dev/null | head -n 1`" -if [ -z "${COSCALC}" ] || [ ! -x ${COSCALC} ]; then - printf "ERROR: \`COSCALC: ${COSCALC}' neither specified nor executable\n" - exit 255 -fi -## }}} - ## default parameters {{{ # default `event file' which used to match `blanksky' files #DFT_EVT="_NOT_EXIST_" @@ -252,7 +233,7 @@ case "${R500_UNI}" in ;; *) printf "## units in \`kpc', convert to \`Chandra pixel'\n" | ${TOLOG} - KPC_PER_PIX=`${COSCALC} ${REDSHIFT} | \grep 'kpc.*pix' | tr -d 'a-zA-Z_#=(),:/ '` + KPC_PER_PIX=`cosmo_calc ${REDSHIFT} | \grep 'kpc.*pix' | tr -d 'a-zA-Z_#=(),:/ '` # convert scientific notation for `bc' KPC_PER_PIX_B=`echo ${KPC_PER_PIX} | sed 's/[eE]/\*10\^/' | sed 's/+//'` printf "## calculated \`kpc/pixel': ${KPC_PER_PIX_B}\n" @@ -446,7 +427,7 @@ export PFILES="./:${PFILES}" ### main ### ## D_A {{{ -D_A_CM=`${COSCALC} ${REDSHIFT} | \grep -i 'd_a.*cm' | awk -F'=' '{ print $2 }' | awk '{ print $1 }'` +D_A_CM=`cosmo_calc ${REDSHIFT} | \grep -i 'd_a.*cm' | awk -F'=' '{ print $2 }' | awk '{ print $1 }'` printf "D_A_CM(${REDSHIFT})= ${D_A_CM}\n" ## D_A }}} @@ -632,4 +613,3 @@ else fi exit 0 - diff --git a/scripts/ciao_r500avgt.sh b/scripts/ciao_r500avgt.sh index feed110..7568cdb 100755 --- a/scripts/ciao_r500avgt.sh +++ b/scripts/ciao_r500avgt.sh @@ -1,50 +1,45 @@ #!/bin/sh -# -unalias -a -export LC_COLLATE=C -########################################################### -## script to extract spectrum and prepare needed files ## -## for calculating the `average temperature' ## -## within (0.1-0.5 r500) region ## -## ## -## NOTE: ## -## 1) r500 default in unit `pixel', if in `kpc', ## -## then `redshift z' and `calculator' are needed. ## -## 2) `background process' is same as `deproj_spectra' ## -## which supports `spectrum', `local' and `blanksky' ## -## 3) ARF/RMF files either provided or use the ARF/RMF ## -## of the outmost region ## -## ## -## Weitian LI <liweitianux@gmail.com> ## -## 2012/08/22 ## -########################################################### ## -## ChangeLogs -## v1.1, 2012/08/26, LIweitiaNux +## To extract the spectrum and prepare the necessary files for +## calculating the average temperature within (0.1-0.5 r500) region. +## +## NOTE: +## 1) r500 default in unit `pixel', if in `kpc', +## then `redshift z' and `calculator' are needed. +## 2) `background process' is same as `deproj_spectra' +## which supports `spectrum', `local' and `blanksky' +## 3) ARF/RMF files either provided or use the ARF/RMF +## of the outmost region +## +## Weitian LI <liweitianux@gmail.com> +## Updated: 2016-06-08 +## +## Change logs +## v1.1, 2012/08/26, Weitian LI ## modify `KPC_PER_PIX', able to use the newest version `calc_distance' -## v1.2, 2012/08/26, LIweitiaNux +## v1.2, 2012/08/26, Weitian LI ## fix a bug with `DFT_BKGD' -## v2.0, 2012/09/04, LIweitiaNux +## v2.0, 2012/09/04, Weitian LI ## add parameter `inner' and `outer' to adjust the region range ## modify parameter `r500' to take `kpc' as the default unit -## v2.1, 2012/10/05, LIweitiaNux +## v2.1, 2012/10/05, Weitian LI ## change `DFT_GRP_CMD' to `group 1 128 4 ...' -## v3.0, 2013/02/09, LIweitiaNux +## v3.0, 2013/02/09, Weitian LI ## modify for new process -## v3.1, 2015/05/27, Aaron LI +## v3.1, 2015/05/27, Weitian LI ## update 'DFT_ARF' & 'DFT_RMF' to find '*.arf' & '*.rmf' files ## (specextract only use .arf & .rmf extensions since revision 2014-12) -## v3.2, 2015/05/30, Aaron LI +## v3.2, 2015/05/30, Weitian LI ## Added options '-cmap he -bin factor 4' to ds9 command -## v4.0, 2015/06/03, Aaron LI +## v4.0, 2015/06/03, Weitian LI ## * Copy needed pfiles to current working directory, and ## set environment variable $PFILES to use these first. ## * Replace 'grep' with '\grep', 'ls' with '\ls' ## * replaced 'grppha' with 'dmgroup' to group spectra ## (dmgroup will add history to fits file, while grppha NOT) +## 2016-06-08, Weitian LI +## * Drop 'calc_distance' in favor of 'cosmo_calc' ## -VERSION="v4.1" -UPDATED="2015/06/03" ## error code {{{ ERR_USG=1 @@ -69,26 +64,11 @@ case "$1" in -[hH]*|--[hH]*) printf "usage:\n" printf " `basename $0` evt=<evt2_clean> r500=<r500_kpc> basedir=<basedir> info=<info_json> inner=<inner_val> outer=<outer_val> regin=<input_reg> regout=<output_reg> bkgd=<blank_evt|lbkg_reg|bkg_spec> nh=<nH> z=<redshift> arf=<arf_file> rmf=<rmf_file> [ grouptype=<NUM_CTS|BIN> grouptypeval=<number> binspec=<binspec> log=<log_file> ]\n" - printf "\nversion:\n" - printf " ${VERSION}, ${UPDATED}\n" exit ${ERR_USG} ;; esac ## usage, help }}} -## comology calculator {{{ -## XXX: MODIFY THIS TO YOUR OWN CASE -## and make sure this `calc' is executable -## NOTES: use `$HOME' instead of `~' in path -COSCALC="`which cosmo_calc calc_distance 2>/dev/null | head -n 1`" -# COSCALC="_path_to_calc_distance_" -# COSCALC="$HOME/bin/mass/calc_distance" -if [ -z "${COSCALC}" ] || [ ! -x ${COSCALC} ]; then - printf "ERROR: \`COSCALC: ${COSCALC}' neither specified nor executable\n" - exit 255 -fi -## }}} - ## default parameters {{{ # default `event file' which used to match `blanksky' files #DFT_EVT="_NOT_EXIST_" @@ -262,7 +242,7 @@ case "${R500_UNI}" in ;; *) printf "## units in \`kpc', convert to \`Chandra pixel'\n" | ${TOLOG} - KPC_PER_PIX=`${COSCALC} ${REDSHIFT} | \grep 'kpc.*pix' | tr -d 'a-zA-Z_#=(),:/ '` + KPC_PER_PIX=`cosmo_calc ${REDSHIFT} | \grep 'kpc.*pix' | tr -d 'a-zA-Z_#=(),:/ '` # convert scientific notation for `bc' KPC_PER_PIX_B=`echo ${KPC_PER_PIX} | sed 's/[eE]/\*10\^/' | sed 's/+//'` printf "## calculated \`kpc/pixel': ${KPC_PER_PIX_B}\n" @@ -578,4 +558,3 @@ _EOF_ ## xspec script }}} exit 0 - |