aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-06 13:11:18 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-06 13:11:18 +0800
commitedd0208c80c3478c563618b64040f42e1cf2b16f (patch)
tree529a29a47d382a7c067626be8c5dbfb452f72739 /scripts
parent904b0374e526d9475d09166a27e1e5c4e81fcf59 (diff)
downloadchandra-acis-analysis-edd0208c80c3478c563618b64040f42e1cf2b16f.tar.bz2
Specify regions format and system for ds9
Also strip trailing white spaces.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ciao_calc_csb.sh9
-rwxr-xr-xscripts/ciao_calc_ct.sh9
-rwxr-xr-xscripts/ciao_genregs.sh28
-rwxr-xr-xscripts/ciao_procevt.sh15
-rwxr-xr-xscripts/ciao_r500avgt.sh8
-rwxr-xr-xscripts/ciao_sbp.sh40
6 files changed, 70 insertions, 39 deletions
diff --git a/scripts/ciao_calc_csb.sh b/scripts/ciao_calc_csb.sh
index fc8a868..6749c64 100755
--- a/scripts/ciao_calc_csb.sh
+++ b/scripts/ciao_calc_csb.sh
@@ -11,9 +11,11 @@
##
## Zhenghao ZHU
## Weitian LI
-## Updated: 2016-06-08
+## Updated: 2017-02-06
##
## Change logs:
+## 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
## 2016-06-08, Weitian LI
## * Add a reference
## * Drop 'calc_distance' in favor of 'cosmo_calc'
@@ -221,7 +223,10 @@ _EOF_
printf "CHECK the regions (R1=${R1}, R2=${R2}) ...\n"
printf "modify if necessary and save with the same name: \`${TMP_REG}'\n"
cp -fv ${TMP_REG} ${TMP_REG%.reg}_orig.reg
-ds9 ${EVT_E} -regions ${TMP_REG} -cmap he -bin factor 4
+ds9 ${EVT_E} -regions format ciao \
+ -regions system physical \
+ -regions ${TMP_REG} \
+ -cmap he -bin factor 4
read -p "> Whether the region exceeds ccd edge?(No/yes/modified) " WR_ANS
case "${WR_ANS}" in
[yY]*)
diff --git a/scripts/ciao_calc_ct.sh b/scripts/ciao_calc_ct.sh
index 2a277e9..cf9b4b0 100755
--- a/scripts/ciao_calc_ct.sh
+++ b/scripts/ciao_calc_ct.sh
@@ -6,9 +6,11 @@
## Junhua GU
## Created: 2012-08-22
## Weitian LI
-## Updated: 2016-06-08
+## Updated: 2017-02-06
##
## Change logs:
+## 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
## 2016-06-08, Weitian LI
## * Drop 'calc_distance' in favor of 'cosmo_calc'
## v2.0, 2015/06/03, Weitian LI
@@ -442,7 +444,10 @@ _EOF_
## open the evt file to verify or modify
printf "## check the generated pie region ...\n"
printf "## if modified, save with the same name \`${REG_OUT}' (overwrite)\n"
-ds9 ${EVT} -regions ${REG_OUT} -cmap he -bin factor 4
+ds9 ${EVT} -regions format ciao \
+ -regions system physical \
+ -regions ${REG_OUT} \
+ -cmap he -bin factor 4
## check the (modified) region (pie region end angle)
printf "check the above region (for pie region end angle) ...\n"
diff --git a/scripts/ciao_genregs.sh b/scripts/ciao_genregs.sh
index 1f6c58a..7ab3f41 100755
--- a/scripts/ciao_genregs.sh
+++ b/scripts/ciao_genregs.sh
@@ -6,10 +6,12 @@
## Author: Weitian LI
## Created: 2013/10/12
##
-VERSION="v1.0"
-UPDATE="2013/10/12"
+VERSION="v2.1"
+UPDATED="2017-02-06"
##
## Changelogs:
+## v2.1, 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
## v2.0, 2015/06/03, Aaron LI
## * Updated script description
## * Replaced 'grep' with '\grep', 'ls' with '\ls'
@@ -73,7 +75,7 @@ if [ -r "${CELL_REG_FILE}" ]; then
fi
# }}}
-## default parameters {{{
+## default parameters {{{
## clean evt2 file
DFT_EVT=`\ls evt2*_clean.fits 2> /dev/null`
## the repro dir
@@ -169,10 +171,10 @@ BASEDIR=`echo ${BASEDIR} | sed 's/\/*$//'`
#background spectrum
if [ -r "${bkgd}" ] ;then
BKGD=${bkgd}
-elif [ -r "${DFT_BKGD}" ] ; then
+elif [ -r "${DFT_BKGD}" ] ; then
BKGD="${DFT_BKGD}"
#ln -svf ${DFT_BKGD} .
-else
+else
read -p ">background spectrum file: " BKGD
if [ ! -d ${BKGD} ] ; then
printf "ERROR on background spectrum file"
@@ -251,7 +253,10 @@ CNTRD_PHY_REG="centroid_phy.reg"
printf "## X centroid: ($X,$Y)\n"
if [ "${F_DS9}" = "YES" ]; then
printf "check the X centroid ...\n"
- ds9 ${EVT_E} -regions ${CNTRD_PHY_REG} -cmap he -bin factor 4
+ ds9 ${EVT_E} -regions format ciao \
+ -regions system physical \
+ -regions ${CNTRD_PHY_REG} \
+ -cmap he -bin factor 4
fi
X0=$X
Y0=$Y
@@ -279,7 +284,10 @@ printf "CMD: ${CMD}\n"
${SCRIPT_DIR}/${GEN_SBPREG_SCRIPT} ${EVT} ${EVT_E} ${X} ${Y} ${BKGD} ${SBP_REG}
if [ "${F_DS9}" = "YES" ]; then
printf "check SBP regions ...\n"
- ds9 ${EVT_E} -regions ${SBP_REG} -cmap sls -bin factor 4
+ ds9 ${EVT_E} -regions format ciao \
+ -regions system physical \
+ -regions ${SBP_REG} \
+ -cmap he -bin factor 4
fi
printf "======== GENERATE SBPROFILE REGIONS FINISHED =======\n\n"
@@ -289,9 +297,11 @@ printf "CMD: ${CMD}\n"
${SCRIPT_DIR}/${GEN_SPCREG_SCRIPT} ${EVT} ${EVT_E} ${BKGD} ${X} ${Y} ${SPC_REG}
if [ "${F_DS9}" = "YES" ]; then
printf "check SPC regions ...\n"
- ds9 ${EVT_E} -regions ${SPC_REG} -cmap he -bin factor 4
+ ds9 ${EVT_E} -regions format ciao \
+ -regions system physical \
+ -regions ${SPC_REG} \
+ -cmap he -bin factor 4
fi
printf "======== GENERATE SPECTRUM REGIONS FINISHED =======\n\n"
exit 0
-
diff --git a/scripts/ciao_procevt.sh b/scripts/ciao_procevt.sh
index 90162bb..5ee8abd 100755
--- a/scripts/ciao_procevt.sh
+++ b/scripts/ciao_procevt.sh
@@ -19,10 +19,12 @@ export LC_COLLATE=C
## 2012/08/16 ##
###########################################################
##
-VERSION="v3.0"
-UPDATED="2015/06/02"
+VERSION="v3.1"
+UPDATED="2017-02-06"
##
## ChangeLogs:
+## v3.1, 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
## v3.0, 2015/06/02, Aaron LI
## * Added 'unalias -a' and 'export LC_COLLATE=C'
## * Replaced 'grep' with '\grep', 'ls' with '\ls'
@@ -156,7 +158,10 @@ celldetect infile=${EVT2_ORIG} outfile="${CELLD}.fits" \
printf "check the result of \`celldetect' ...\n"
printf "modify if necessary and save as the same name, \`${CELLD}.reg'\n"
cp -fv ${CELLD}.reg ${CELLD}_orig.reg
-ds9 ${EVT2_ORIG} -region ${CELLD}.reg
+ds9 ${EVT2_ORIG} -regions format ciao \
+ -regions system physical \
+ -regions ${CELLD}.reg \
+ -cmap he -bin factor 2
EVT2_RMSRCS="${ROOTNAME}_rmsrcs.fits"
punlearn dmcopy
@@ -167,7 +172,7 @@ LC_REG="ex_bkg.reg"
printf "filter flares ...\n"
printf "select a big source region and save as \`${LC_REG}'\n"
touch ${LC_REG}
-ds9 ${EVT2_RMSRCS}
+ds9 ${EVT2_RMSRCS} -cmap he -bin factor 2
printf "create the lightcurve ...\n"
LC="${LC_REG%.reg}.lc"
@@ -199,5 +204,3 @@ dmcopy infile="${EVT2_RMSRCS}[@${GTI}]" outfile=${EVT2_CLEAN} clobber=yes
## main process }}}
printf "FINISHED\n"
-
-
diff --git a/scripts/ciao_r500avgt.sh b/scripts/ciao_r500avgt.sh
index 7568cdb..b94554b 100755
--- a/scripts/ciao_r500avgt.sh
+++ b/scripts/ciao_r500avgt.sh
@@ -12,7 +12,6 @@
## of the outmost region
##
## Weitian LI <liweitianux@gmail.com>
-## Updated: 2016-06-08
##
## Change logs
## v1.1, 2012/08/26, Weitian LI
@@ -39,6 +38,8 @@
## (dmgroup will add history to fits file, while grppha NOT)
## 2016-06-08, Weitian LI
## * Drop 'calc_distance' in favor of 'cosmo_calc'
+## 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
##
## error code {{{
@@ -446,7 +447,10 @@ _EOF_
## open the evt file to verify or modify
printf "## check the generated pie region ...\n"
printf "## if modified, save with the same name \`${REG_OUT}' (overwrite)\n"
-ds9 ${EVT} -region ${REG_OUT} -cmap he -bin factor 4
+ds9 ${EVT} -regions format ciao \
+ -regions system physical \
+ -regions ${REG_OUT} \
+ -cmap he -bin factor 4
## check the (modified) region (pie region end angle)
printf "check the above region (for pie region end angle) ...\n"
diff --git a/scripts/ciao_sbp.sh b/scripts/ciao_sbp.sh
index 0e7acd5..5703467 100755
--- a/scripts/ciao_sbp.sh
+++ b/scripts/ciao_sbp.sh
@@ -8,10 +8,12 @@
## Weitian LI <liweitianux@gmail.com>
## Created: 2012/08/16
##
-VERSION="v4.0"
-UPDATED="2015/06/03"
+VERSION="v4.1"
+UPDATED="2017-02-06"
##
## ChangeLogs:
+## v4.1, 2017-02-06, Weitian LI
+## * Specify regions format and system for ds9
## v4.0, 2015/06/03, Aaron LI
## * Copy needed pfiles to current working directory, and
## set environment variable $PFILES to use these first.
@@ -23,9 +25,9 @@ UPDATED="2015/06/03"
## * Updated this document of the script.
## * Added 'SKIP SINGLE' to the generated QDP of SBP file.
## v3.1, 2013/02/01, Zhenghao ZHU
-## * removes the region in ccd gap of ACIS_I
+## * removes the region in ccd gap of ACIS_I
## * removes the region in the area of point source
-## * provide asol file to correct offset
+## * provide asol file to correct offset
##
unalias -a
@@ -78,7 +80,7 @@ DFT_EXPMAP="`\ls expmap*.fits 2> /dev/null | head -n 1`"
# default `radial region file' to extract surface brightness
#DFT_SBP_REG="_NOT_EXIST_"
DFT_SBP_REG="sbprofile.reg"
-# defalut pointsource region file
+# defalut pointsource region file
DFT_CELL_REG="`\ls celld*.reg 2> /dev/null`"
# defalut asol file
DFT_ASOL_FILE="`\ls -1 pcad*asol*fits 2> /dev/null`"
@@ -185,11 +187,11 @@ else
BKG="NULL"
fi
# check cell region file
-if [ -r "${cellreg}" ]; then
+if [ -r "${cellreg}" ]; then
CELL_REG="${cellreg}"
elif [ -r "${DFT_CELL_REG}" ] ; then
CELL_REG="${DFT_CELL_REG}"
-else
+else
read -p "> celldetect region file: " CELL_REG
if [ ! -r "${CELL_REG}" ]; then
printf "ERROR: cannot access given \`${CELL_REG}' region file \n"
@@ -281,7 +283,7 @@ TMP_REC="_tmp_rec.reg"
if [ "${ACIS_TYPE}" = "S" ]; then
# ACIS-S
punlearn dmlist
- dmlist infile="${SKYFOV}[ccd_id=${CCD}][cols POS]" opt="data,clean" | awk '{for (i=1;i<=NF;i++) print $i }' |sed -e ':a;N;s/\n/,/;ta' | awk -F"]," '{print "polygon("$2}' | awk -F"NaN" '{print $1}' >${TMP_LIST}
+ dmlist infile="${SKYFOV}[ccd_id=${CCD}][cols POS]" opt="data,clean" | awk '{for (i=1;i<=NF;i++) print $i }' |sed -e ':a;N;s/\n/,/;ta' | awk -F"]," '{print "polygon("$2}' | awk -F"NaN" '{print $1}' >${TMP_LIST}
python ${SCRIPT_DIR}/${CCDGAP_SCRIPT} ${TMP_LIST} >${TMP_REC}
XC=` cat ${TMP_REC} | awk -F\( '{print $2}' |awk -F\) '{print $1}' |awk -F\, '{print $1}'`
YC=` cat ${TMP_REC} | awk -F\( '{print $2}' |awk -F\) '{print $1}' |awk -F\, '{print $2}'`
@@ -296,8 +298,8 @@ if [ "${ACIS_TYPE}" = "S" ]; then
break
fi
done
- ANG=`echo "${ANG}/180*3.1415926" |bc -l`
- CCD_1_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)-$2*sin($3)}' `
+ ANG=`echo "${ANG}/180*3.1415926" |bc -l`
+ CCD_1_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)-$2*sin($3)}' `
CCD_2_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1+$2*cos($3)-$2*sin($3)}' `
CCD_3_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)+$2*sin($3)}' `
CCD_4_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1+$2*cos($3)+$2*sin($3)}' `
@@ -360,9 +362,9 @@ elif [ "${ACIS_TYPE}" = "I" ]; then
# ACIS-I
TMP_REG_FILE_CCD="_ccd_tmp.reg"
[ -e "${TMP_REG_FILE_CCD}" ] && mv -f ${TMP_REG_FILE_CCD} ${TMP_REG_FILE_CCD}_bak
- for i in `seq 0 3` ; do
+ for i in `seq 0 3` ; do
punlearn dmlist
- dmlist infile="${SKYFOV}[ccd_id=${i}][cols POS]" opt="data,clean" | awk '{for (i=1;i<=NF;i++) print $i }' |sed -e ':a;N;s/\n/,/;ta' | awk -F"]," '{print "polygon("$2}' | awk -F"NaN" '{print $1}' >${TMP_LIST}
+ dmlist infile="${SKYFOV}[ccd_id=${i}][cols POS]" opt="data,clean" | awk '{for (i=1;i<=NF;i++) print $i }' |sed -e ':a;N;s/\n/,/;ta' | awk -F"]," '{print "polygon("$2}' | awk -F"NaN" '{print $1}' >${TMP_LIST}
python ${SCRIPT_DIR}/${CCDGAP_SCRIPT} ${TMP_LIST} >${TMP_REC}
XC=` cat ${TMP_REC} | awk -F\( '{print $2}' |awk -F\) '{print $1}' |awk -F\, '{print $1}'`
YC=` cat ${TMP_REC} | awk -F\( '{print $2}' |awk -F\) '{print $1}' |awk -F\, '{print $2}'`
@@ -377,8 +379,8 @@ elif [ "${ACIS_TYPE}" = "I" ]; then
break
fi
done
- ANG=`echo "${ANG}/180*3.1415926" |bc -l`
- CCD_1_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)-$2*sin($3)}' `
+ ANG=`echo "${ANG}/180*3.1415926" |bc -l`
+ CCD_1_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)-$2*sin($3)}' `
CCD_2_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1+$2*cos($3)-$2*sin($3)}' `
CCD_3_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1-$2*cos($3)+$2*sin($3)}' `
CCD_4_X_RAW=` echo " ${XC} ${ADD_L} ${ANG} "| awk '{print $1+$2*cos($3)+$2*sin($3)}' `
@@ -461,14 +463,17 @@ CELL_REG_USE=`cat ${CELL_REG} | \grep \( | sed -e ':a;N;s/\n/-/;ta'`
if [ "${ACIS_TYPE}" = "S" ]; then
\grep -iE '^(pie|annulus)' ${SBP_REG_FIX} | sed "s/$/\ \&\ `cat ${REG_FILE_CCD}`/" | sed "s/$/\ \-\ ${CELL_REG_USE}/" > ${SBP_REG_INCCD}
- else
+ else
L=`cat ${SBP_REG_FIX} | wc -l `
- for i in `seq 1 $L` ; do
+ for i in `seq 1 $L` ; do
echo "`cat ${SBP_REG_FIX} |head -n $i | tail -n 1 ` & `cat ${REG_FILE_CCD} | head -n 1 `- ${CELL_REG_USE} | `cat ${SBP_REG_FIX} |head -n $i | tail -n 1` & `cat ${REG_FILE_CCD} | head -n 2| tail -n 1 `- ${CELL_REG_USE} |`cat ${SBP_REG_FIX} |head -n $i | tail -n 1 ` & `cat ${REG_FILE_CCD} | head -n 3 | tail -n 1 `- ${CELL_REG_USE} |`cat ${SBP_REG_FIX} |head -n $i | tail -n 1 ` & `cat ${REG_FILE_CCD} | tail -n 1 `- ${CELL_REG_USE} " >>${SBP_REG_INCCD}
done
fi
-# ds9 ${EVT_E} -region ${SBP_REG_INCCD}
+# ds9 ${EVT_E} -regions format ciao \
+# -regions system physical \
+# -regions ${SBP_REG_INCCD} \
+# -cmap he -bin factor 4
## `surface brightness profile' related data {{{
## extract sbp
@@ -548,4 +553,3 @@ sed -i'' '/#.*/d' ${SBP_FLUX}
## main }}}
exit 0
-