From 57ff0ed9c57a2c4bca2e7e1a592b6636e0457887 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 27 May 2015 10:49:15 +0800 Subject: Updated ciao_calc_ct.sh, ciao_expcorr.sh, ciao_r500avgt.sh, ciao_sbp.sh ciao_r500avgt.sh, ciao_calc_ct.sh: Updated to also find '.rmf' & '.arf' files in addition to '.wrmf' & '.warf'. ciao_sbp.sh: Skip skyfov generation if already exists Renamed parameter 'aspec' to 'aspect' ciao_expcorr.sh Added 'aspect' parameter for skyfov to fix the 'FoV shift bug' --- scripts/ciao_calc_ct.sh | 16 ++++++----- scripts/ciao_expcorr.sh | 56 ++++++++++++++++++--------------------- scripts/ciao_r500avgt.sh | 13 +++++---- scripts/ciao_sbp.sh | 69 ++++++++++++++++++++++++------------------------ 4 files changed, 78 insertions(+), 76 deletions(-) (limited to 'scripts') diff --git a/scripts/ciao_calc_ct.sh b/scripts/ciao_calc_ct.sh index 926c785..5f76ed5 100755 --- a/scripts/ciao_calc_ct.sh +++ b/scripts/ciao_calc_ct.sh @@ -16,12 +16,16 @@ export LC_COLLATE=C ########################################################### ## ChangeLogs -## 2014/06/18: 'cooling_time2.sh' -> 'ciao_calc_ct.sh' +## v1.1, 2014/06/18 +## 'cooling_time2.sh' -> 'ciao_calc_ct.sh' +## 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) ########################################################### ## about, used in `usage' {{{ -VERSION="v1.1" -UPDATE="2012-08-26" +VERSION="v1.2" +UPDATE="2015-05-27" ## about }}} ## error code {{{ @@ -45,7 +49,7 @@ ERR_UNI=61 case "$1" in -[hH]*|--[hH]*) printf "usage:\n" - printf " `basename $0` basedir= evt= r500= regin= regout= bkgd= nh= z= arf= rmf= [ grpcmd= log= ]\n" + printf " `basename $0` basedir= evt= r500= regin= regout= bkgd= nh= z= arf= rmf= [ grpcmd= log= ]\n" printf "\nversion:\n" printf "${VERSION}, ${UPDATE}\n" exit ${ERR_USG} @@ -81,8 +85,8 @@ DFT_REG_IN="rspec.reg" # default output region file (0.1-0.5 r500 region) DFT_REG_OUT="cooling.reg" # default ARF/RMF, the one of the outmost region -DFT_ARF="`ls r1_*.warf 2> /dev/null`" -DFT_RMF="`ls r1_*.wrmf 2> /dev/null`" +DFT_ARF="`ls r1_*.warf r1_*.arf 2> /dev/null`" +DFT_RMF="`ls r1_*.wrmf r1_*.rmf 2> /dev/null`" # default `group command' for `grppha' #DFT_GRP_CMD="group 1 128 2 129 256 4 257 512 8 513 1024 16" diff --git a/scripts/ciao_expcorr.sh b/scripts/ciao_expcorr.sh index c72973f..c1d7905 100755 --- a/scripts/ciao_expcorr.sh +++ b/scripts/ciao_expcorr.sh @@ -1,36 +1,32 @@ #!/bin/sh -# -unalias -a -export LC_COLLATE=C -########################################################### -## make `image' from `evt file' ## -## make `spectral weight' using `make_instmap_weights' ## -## use `fluximage' to generating `exposure map' ## -## make `exposure-corrected' image ## -## and extract `surface brighness profile' ## -## ## -## NOTES: ## -## only ACIS-I (chip: 0-3) and ACIS-S (chip: 7) supported## -## `merge_all' conflict with Heasoft's `pget' etc. tools ## -## ## -## LIweitiaNux ## -## August 16, 2012 ## -########################################################### - -########################################################### +## +## make `image' from `evt file' +## make `spectral weight' using `make_instmap_weights' +## use `fluximage' to generating `exposure map' +## make `exposure-corrected' image +## and extract `surface brighness profile' +## +## NOTES: +## only ACIS-I (chip: 0-3) and ACIS-S (chip: 7) supported +## `merge_all' conflict with Heasoft's `pget' etc. tools +## +## Weitian LI +## 2012/08/16 +UPDATED="2014/10/30" +## ## ChangeLogs: +## v2.1, 2014/10/30, Weitian LI +## Add 'aspect' parameter for 'skyfov' to fix the 'FoV shift bug' ## v2.0, 2014/07/29, Weitian LI ## `merge_all' deprecated, use `fluximage' if possible ## v1.2, 2012-08-21, LIweitiaNux ## set `ardlib' before process `merge_all' ## v1.1, 2012-08-21, LIweitiaNux ## fix a bug with `sed' -########################################################### +## -## about, used in `usage' {{{ -VERSION="v2.0" -UPDATE="2014-07-29" -## about }}} +unalias -a +export LC_COLLATE=C ## error code {{{ ERR_USG=1 @@ -54,8 +50,8 @@ case "$1" in -[hH]*|--[hH]*) printf "usage:\n" printf " `basename $0` evt= energy= basedir= nh= z= temp= abund= [ logfile= ]\n" - printf "\nversion:\n" - printf "${VERSION}, ${UPDATE}\n" + printf "\nupdated:\n" + printf "${UPDATED}\n" exit ${ERR_USG} ;; esac @@ -300,11 +296,8 @@ make_instmap_weights outfile="${SPEC_WGT}" \ ## spectral weights }}} ## generate `skyfov' -# XXX: omit `aspec', NOT provide `asol' file -# otherwise the size of evt_img NOT match the `expmap' printf "generate skyfov ...\n" -SKYFOV="_skyfov.fits" -[ -e "${SKYFOV}" ] && rm -fv ${SKYFOV} +SKYFOV="skyfov.fits" punlearn skyfov skyfov infile="${EVT}" outfile="${SKYFOV}" aspect="@${ASOLIS}" clobber=yes @@ -348,7 +341,8 @@ if `which merge_all >/dev/null 2>&1`; then ## XXX: `merge_all' needs `asol files' in working directory printf "link asol files into currect dir (\`merge_all' needed) ...\n" for f in `cat ${ASOLIS}`; do - ln -sv ${BASEDIR}/${f} . + asol=`basename ${f}` + ln -svf ${BASEDIR}/${asol} . done printf "use \`merge_all' to generate \`exposure map' ONLY ...\n" diff --git a/scripts/ciao_r500avgt.sh b/scripts/ciao_r500avgt.sh index 9a8dffd..3318bb4 100755 --- a/scripts/ciao_r500avgt.sh +++ b/scripts/ciao_r500avgt.sh @@ -32,11 +32,14 @@ export LC_COLLATE=C ## change `DFT_GRP_CMD' to `group 1 128 4 ...' ## v3.0, 2013/02/09, LIweitiaNux ## modify for new process +## 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) ########################################################### ## about, used in `usage' {{{ -VERSION="v3.0" -UPDATE="2013-02-09" +VERSION="v3.1" +UPDATE="2015-05-27" ## about }}} ## error code {{{ @@ -61,7 +64,7 @@ ERR_UNI=61 case "$1" in -[hH]*|--[hH]*) printf "usage:\n" - printf " `basename $0` evt= r500= basedir= info= inner= outer= regin= regout= bkgd= nh= z= arf= rmf= [ grpcmd= log= ]\n" + printf " `basename $0` evt= r500= basedir= info= inner= outer= regin= regout= bkgd= nh= z= arf= rmf= [ grpcmd= log= ]\n" printf "\nversion:\n" printf "${VERSION}, ${UPDATE}\n" exit ${ERR_USG} @@ -97,8 +100,8 @@ DFT_REG_IN="rspec.reg" DFT_INNER="0.1" DFT_OUTER="0.5" # default ARF/RMF, the one of the outmost region -DFT_ARF="`ls -1 r?_*.warf 2> /dev/null | tail -n 1`" -DFT_RMF="`ls -1 r?_*.wrmf 2> /dev/null | tail -n 1`" +DFT_ARF="`ls -1 r?_*.warf r?_*.arf 2> /dev/null | tail -n 1`" +DFT_RMF="`ls -1 r?_*.wrmf r?_*.rmf 2> /dev/null | tail -n 1`" # default `group command' for `grppha' DFT_GRP_CMD="group min 25" diff --git a/scripts/ciao_sbp.sh b/scripts/ciao_sbp.sh index 9c4963c..ef636ca 100755 --- a/scripts/ciao_sbp.sh +++ b/scripts/ciao_sbp.sh @@ -1,35 +1,34 @@ #!/bin/sh -# -unalias -a -export LC_COLLATE=C -########################################################### -## extract `surface brighness profile' ## -## ## -## NOTES: ## -## only ACIS-I (chip: 0-3) and ACIS-S (chip: 7) supported## -## `merge_all' conflict with Heasoft's `pget' etc. tools ## -## ## -## LIweitiaNux ## -## August 16, 2012 ## -########################################################### - -########################################################### -## Changes: +## +## Extract `surface brighness profile' +## +## NOTES: +## * Only ACIS-I (chip: 0-3) and ACIS-S (chip: 7) supported +## +## Weitian LI +## Created: 2012/08/16 +UPDATED="2015/03/29" +## +## ChangeLogs: +## 2015/03/29, Weitian LI +## * Skip skyfov generation if it already exists. +## * Rename parameter 'aspec' to 'aspect' to match with 'skyfov' +## 2015/03/06, Weitian LI +## * 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 the area of point source ## need asol file to prevent offset -########################################################### +## + +unalias -a +export LC_COLLATE=C SCRIPT_PATH=`readlink -f $0` SCRIPT_DIR=`dirname ${SCRIPT_PATH}` CCDGAP_SCRIPT="chandra_ccdgap_rect.py" -## about, used in `usage' {{{ -VERSION="v3.1" -UPDATE="2013-02-01" -## about }}} - ## error code {{{ ERR_USG=1 ERR_DIR=11 @@ -52,9 +51,9 @@ ERR_CIAO=100 case "$1" in -[hH]*|--[hH]*) printf "usage:\n" - printf " `basename $0` evt_e= reg= expmap= cellreg= aspec= [bkg= log= ]\n" - printf "\nversion:\n" - printf "${VERSION}, ${UPDATE}\n" + printf " `basename $0` evt_e= reg= expmap= cellreg= aspect= [bkg= log= ]\n" + printf "\nupdated:\n" + printf "${UPDATED}\n" exit ${ERR_USG} ;; esac @@ -76,7 +75,7 @@ DFT_SBP_REG="sbprofile.reg" # defalut pointsource region file DFT_CELL_REG="`ls celld*.reg 2> /dev/null`" # defalut asol file -DFT_ASOL_FILE="`ls pcad*asol*fits 2> /dev/null`" +DFT_ASOL_FILE="`ls -1 pcad*asol*fits 2> /dev/null`" # default `log file' DFT_LOGFILE="sbp_`date '+%Y%m%d'`.log" @@ -193,8 +192,8 @@ else fi printf "## use cell reg file(s): \`${CELL_REG}'\n" | ${TOLOG} # check asol file -if [ -r "${aspec}" ]; then - ASOL_FILE="${aspec}" +if [ -r "${aspect}" ]; then + ASOL_FILE="${aspect}" elif [ -r "${DFT_ASOL_FILE}" ] ; then ASOL_FILE="${DFT_ASOL_FILE}" else @@ -249,12 +248,12 @@ fi ## main process {{{ ## generate `skyfov' -# XXX: omit `aspec', NOT provide `asol' file -# otherwise the size of evt_img NOT match the `expmap' -printf "generate skyfov ...\n" -SKYFOV="_skyfov.fits" -punlearn skyfov -skyfov infile="${EVT_E}" outfile="${SKYFOV}" aspec="${ASOL_FILE}" clobber=yes +SKYFOV="skyfov.fits" +if [ ! -r "${SKYFOV}" ]; then + printf "generate skyfov ...\n" + punlearn skyfov + skyfov infile="${EVT_E}" outfile="${SKYFOV}" aspect="${ASOL_FILE}" clobber=yes +fi ## get CCD fov regions {{{ printf "make regions for CCD ...\n" @@ -498,6 +497,8 @@ cp -fv ${SBP_TXT} ${SBP_QDP} sed -i'' 's/#/!/g' ${SBP_QDP} # add QDP commands sed -i'' '1 i\ +SKIP SINGLE' ${SBP_QDP} +sed -i'' '1 i\ READ SERR 1 2' ${SBP_QDP} sed -i'' '2 i\ LABEL Y "Surface Flux (photons/cm\\u2\\d/pixel\\u2\\d/s)"' ${SBP_QDP} -- cgit v1.2.2