aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/ciao_procevt.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2015-06-03 14:02:51 +0800
committerAaron LI <aaronly.me@outlook.com>2015-06-03 14:02:51 +0800
commitb5f43f1b99c8b181af2c657a5b95616f09ad8232 (patch)
tree342cee06dafea1ae7692b049d217c53ebc5a9a6b /scripts/ciao_procevt.sh
parent57ff0ed9c57a2c4bca2e7e1a592b6636e0457887 (diff)
downloadchandra-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/ciao_procevt.sh')
-rwxr-xr-xscripts/ciao_procevt.sh50
1 files changed, 34 insertions, 16 deletions
diff --git a/scripts/ciao_procevt.sh b/scripts/ciao_procevt.sh
index d73bfaf..90162bb 100755
--- a/scripts/ciao_procevt.sh
+++ b/scripts/ciao_procevt.sh
@@ -1,5 +1,7 @@
#!/bin/sh
#
+unalias -a
+export LC_COLLATE=C
###########################################################
## process `evt2 file' generated by `chandra_repro' ##
## to produce a `clean evt2 file' ##
@@ -13,23 +15,26 @@
## if `DETNAM' has `0123', then `ACIS-I' ##
## if `DETNAM' has `7', then `ACIS-S' ##
## ##
-## LIweitiaNux <liweitianux@gmail.com> ##
-## August 16, 2012 ##
-###########################################################
-
+## Weitian LI <liweitianux@gmail.com># ##
+## 2012/08/16 ##
###########################################################
+##
+VERSION="v3.0"
+UPDATED="2015/06/02"
+##
## ChangeLogs:
+## v3.0, 2015/06/02, Aaron LI
+## * Added 'unalias -a' and 'export LC_COLLATE=C'
+## * Replaced 'grep' with '\grep', 'ls' with '\ls'
+## * Copy needed pfiles to current working directory, and
+## set environment variable $PFILES to use these first.
## v2.2, 2014/10/30, Weitian LI
-## small fix to the generation of chips script:
-## changed '>>' to '>'
-## v2.1, 2012/08/16, LIweitiaNux
+## small fix to the generation of chips script:
+## changed '>>' to '>'
+## v2.1, 2012/08/16, Weitian LI
## improve invoke `chips', run it in a separate terminal
-###########################################################
+##
-## about, used in `usage' {{{
-VERSION="v2"
-UPDATE="2012-08-16"
-## about }}}
## error code {{{
ERR_USG=1
@@ -52,7 +57,7 @@ case "$1" in
printf "usage:\n"
printf " `basename $0` evt=<raw_evt_file>\n"
printf "\nversion:\n"
- printf "${VERSION}, ${UPDATE}\n"
+ printf " ${VERSION}, ${UPDATED}\n"
exit ${ERR_USG}
;;
esac
@@ -61,7 +66,7 @@ esac
## default parameters {{{
# default `event file' which used to match `blanksky' files
#DFT_EVT="_NOT_EXIST_"
-DFT_EVT="`ls acisf?????*_repro_evt2.fits 2> /dev/null`"
+DFT_EVT="`\ls acisf?????*_repro_evt2.fits 2> /dev/null`"
## default parameters }}}
## functions {{{
@@ -100,16 +105,29 @@ fi
printf "## use evt file: \`${EVT}'\n"
## parameters }}}
+## prepare parameter files (pfiles) {{{
+CIAO_TOOLS="dmkeypar dmcopy celldetect dmextract"
+
+# Copy necessary pfiles for localized usage
+for tool in ${CIAO_TOOLS}; do
+ pfile=`paccess ${tool}`
+ [ -n "${pfile}" ] && punlearn ${tool} && cp -Lvf ${pfile} .
+done
+
+# Modify environment variable 'PFILES' to use local pfiles first
+export PFILES="./:${PFILES}"
+## pfiles }}}
+
## determine ACIS type {{{
punlearn dmkeypar
DETNAM=`dmkeypar ${EVT} DETNAM echo=yes`
-if echo ${DETNAM} | grep -q 'ACIS-0123'; then
+if echo ${DETNAM} | \grep -q 'ACIS-0123'; then
printf "## \`DETNAM' (${DETNAM}) has chips 0123\n"
printf "## ACIS-I\n"
ACIS_TYPE="ACIS-I"
CCD="0:3"
ROOTNAME="evt2_c`echo ${CCD} | tr ':' '-'`"
-elif echo ${DETNAM} | grep -q 'ACIS-[0-6]*7'; then
+elif echo ${DETNAM} | \grep -q 'ACIS-[0-6]*7'; then
printf "## \`DETNAM' (${DETNAM}) has chip 7\n"
printf "## ACIS-S\n"
ACIS_TYPE="ACIS-S"