2015年2月12日木曜日

bash script to run XSPEC and find parameter error

(2015-02-12 for ASTRO-H simulation)

#!/bin/bash
# xspec find parameter range
# only 1 parameter fit

this=fitC1

# input
model_xcm=$1
data=$2

# fit range
free_p=$3
p_0=$4
p_width=$5
p_min=$6
p_max=$7

#default
# fit energy range
e_min=6.5
e_max=6.8
delta_chi=$DELTA_CHI

resp=${SXS_RMF}
arf=${SXS_ARF}

# output
if [ ! -e ${OUTDIR} ]; then
    echo "mkdir ${OUTDIR}"
    mkdir -p ${OUTDIR}
fi

log=${OUTDIR}/${this}_para${free_p}.log
com=${OUTDIR}/${this}_para${free_p}.xcm
ps=${OUTDIR}/${this}_para${free_p}.ps

# xspec will run ${model}

cat >| $com <que no
data ${data}

resp 1 $resp
arf 1 $arf

setp ene
cpd /xs

ig 0.0-${e_min} ${e_max}-**
@${model_xcm}

log $log
show all
fre 1-6
thaw ${free_p}
newp ${free_p}          ${p_0} ${p_width} ${p_min} ${p_min} ${p_max} ${p_max}
show free

plot d ratio

fit
fit
err ${delta_chi} ${free_p}
fit ${free_p}
err ${delta_chi} ${free_p}

log none

cpd $ps/vps
plot d ratio
cpd /xs
quit
y

EOF

xspec - $com

echo "check ${OUTDIR}"

















0 件のコメント:

コメントを投稿