From 92c2197bb5ba211978c2521e958b4a5ddb805695 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 26 Apr 2016 21:39:06 +0800 Subject: prepare_sbpfit_dir.sh: greatly simplify --- prepare_sbpfit_dir.sh | 77 +++++++++++++++++---------------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/prepare_sbpfit_dir.sh b/prepare_sbpfit_dir.sh index 100f0e9..5c5e5b3 100755 --- a/prepare_sbpfit_dir.sh +++ b/prepare_sbpfit_dir.sh @@ -5,63 +5,38 @@ # # Aaron LI # Created: 2016-03-28 +# Updated: 2016-04-26 +# +# Changelog: +# 2016-04-26: +# * Do NOT prepare the sbpfit config, just link needed files +# * Remove the case that source has "ne" and "sw" two parts (dropped sources) # - -prepare() { - img_dir="$1" - info="$2" - ln -sv ${img_dir}/sbprofile.* ${img_dir}/sbprofile_rmid.fits . - ln -sv ${img_dir}/evt2_c*_clean.fits . - # sbpfit config - cp ${SBPFIT_SBETA_CONF} ${SBPFIT_DBETA_CONF} . - date=`date --iso-8601=seconds` - sed -i'' -e "s##${date}#" `basename ${SBPFIT_SBETA_CONF}` - sed -i'' -e "s##${date}#" `basename ${SBPFIT_DBETA_CONF}` - if [ -n "${info}" ]; then - name=`grep 'Source Name' ${info} | awk -F'"' '{ print $4 }'` - obsid=`grep 'Obs. ID' ${info} | awk -F':' '{ print $2 }' | tr -d ' ,'` - echo "Name: ${name}; ObsID: ${obsid}" - # sbeta - sed -i'' -e "s##${name}#" `basename ${SBPFIT_SBETA_CONF}` - sed -i'' -e "s##${obsid}#" `basename ${SBPFIT_SBETA_CONF}` - # dbeta - sed -i'' -e "s##${name}#" `basename ${SBPFIT_DBETA_CONF}` - sed -i'' -e "s##${obsid}#" `basename ${SBPFIT_DBETA_CONF}` - fi -} -if [ $# -ne 2 ]; then - echo "Usage:" - echo " `basename $0` " - exit 1 -fi +case "$1" in + -[hH]*) + echo "Usage:" + echo " `basename $0` ..." + exit 1 + ;; +esac -CUR_DIR=`pwd -P` -CONFIG_DIR=`realpath $1` -SBPFIT_SBETA_CONF="${CONFIG_DIR}/sbpfit_sbeta.conf" -SBPFIT_DBETA_CONF="${CONFIG_DIR}/sbpfit_dbeta.conf" +SBPFIT_DIR="sbpfit" +INIT_DIR=`pwd -P` -cat $2 | while read repro; do - echo "*** ${repro} ***" - cd ${CUR_DIR} - cd ${repro} - REPRO_DIR=`pwd -P` - SBPFIT_DIR="${REPRO_DIR}/sbpfit" +while [ ! -z "$1" ]; do + reprodir="$1" + shift + echo "*** ${reprodir} ***" + cd ${INIT_DIR} + cd ${reprodir} [ -d "${SBPFIT_DIR}" ] && mv -fv ${SBPFIT_DIR} ${SBPFIT_DIR}_bak mkdir ${SBPFIT_DIR} && cd ${SBPFIT_DIR} - if [ -d "../img/ne" ] && [ -d "../img/sw" ]; then - echo "NOTE: exists 'ne' and 'sw' two parts" - mkdir ne && cd ne - INFO=`realpath ${REPRO_DIR}/*ne_INFO.json 2>/dev/null` - prepare ../../img/ne ${INFO} - cd ${SBPFIT_DIR} - mkdir sw && cd sw - INFO=`realpath ${REPRO_DIR}/*sw_INFO.json 2>/dev/null` - prepare ../../img/sw ${INFO} - else - INFO=`realpath ${REPRO_DIR}/*_INFO.json 2>/dev/null` - prepare ../img ${INFO} - fi + img_dir="../img" + ln -sv ${img_dir}/sbprofile.* . + ln -sv ${img_dir}/sbprofile_rmid.fits . + ln -sv ${img_dir}/evt2_c*_clean.fits . + ln -sv ${img_dir}/*_img_*_fill.png . done -- cgit v1.2.2