diff options
author | Aaron LI <aaronly.me@outlook.com> | 2015-06-03 14:02:51 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2015-06-03 14:02:51 +0800 |
commit | b5f43f1b99c8b181af2c657a5b95616f09ad8232 (patch) | |
tree | 342cee06dafea1ae7692b049d217c53ebc5a9a6b /scripts/chandra_bkg_rescale.sh | |
parent | 57ff0ed9c57a2c4bca2e7e1a592b6636e0457887 (diff) | |
download | chandra-acis-analysis-b5f43f1b99c8b181af2c657a5b95616f09ad8232.tar.bz2 |
Update various script to use localized pfiles to avoid collisons.
* Copy needed pfiles to current working directory, and
set environment variable $PFILES to use these first.
Thus multiple instance of CIAO tools can be run at the same
without pfiles collsions.
* Replace 'ls' with '\ls', 'grep' with '\grep'
* Many minor updates/fixes
Diffstat (limited to 'scripts/chandra_bkg_rescale.sh')
-rwxr-xr-x | scripts/chandra_bkg_rescale.sh | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/scripts/chandra_bkg_rescale.sh b/scripts/chandra_bkg_rescale.sh index ae13af1..8d4abc7 100755 --- a/scripts/chandra_bkg_rescale.sh +++ b/scripts/chandra_bkg_rescale.sh @@ -3,8 +3,15 @@ # background rescale, by adjusting `BACKSCAL' # according to the photon flux values in `9.5-12.0 keV' # -# LIweitiaNux <liweitianux@gmail.com> -# August 14, 2012 +# Weitian LI <liweitianux@gmail.com> +# 2012/08/14 +# +# Changelogs: +# 2015/06/03, Aaron LI +# * Copy needed pfiles to tmp directory, +# set environment variable $PFILES to use these first. +# and remove them after usage. +# ## background rescale (BACKSCAL) {{{ # rescale background according to particle background @@ -39,7 +46,7 @@ bkg_rescale() { } ## bkg rescale }}} -if [ $# -ne 2 ]; then +if [ $# -ne 2 ] || [ "x$1" = "x-h" ]; then printf "usage:\n" printf " `basename $0` <src_spec> <bkg_spec>\n" printf "\nNOTE:\n" @@ -47,8 +54,27 @@ if [ $# -ne 2 ]; then exit 1 fi +## prepare parameter files (pfiles) {{{ +CIAO_TOOLS="dmstat dmkeypar dmhedit" + +PFILES_TMPDIR="/tmp/pfiles-$$" +[ -d "${PFILES_TMPDIR}" ] && rm -rf ${PFILES_TMPDIR} || mkdir ${PFILES_TMPDIR} + +# Copy necessary pfiles for localized usage +for tool in ${CIAO_TOOLS}; do + pfile=`paccess ${tool}` + [ -n "${pfile}" ] && punlearn ${tool} && cp -Lvf ${pfile} ${PFILES_TMPDIR}/ +done + +# Modify environment variable 'PFILES' to use local pfiles first +export PFILES="${PFILES_TMPDIR}:${PFILES}" +## pfiles }}} + # perform `bkg_rescale' bkg_rescale "$1" "$2" +# clean pfiles +rm -rf ${PFILES_TMPDIR} + exit 0 |