From b635a7644529edbfd7e53410c9e98b255ecd1f7c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 8 Jun 2016 22:24:49 +0800 Subject: Drop calc_distance support in favor of cosmo_calc --- scripts/ciao_calc_ct.sh | 46 +++++++++--------------------- 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= evt= r500= regin= regout= bkgd= nh= z= arf= rmf= [ grouptype= grouptypeval= binspec= log= ]\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 ## -## 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 +## 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= r500= basedir= info= inner= outer= regin= regout= bkgd= nh= z= arf= rmf= [ grouptype= grouptypeval= binspec= log= ]\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 - -- cgit v1.2.2