blob: 7dea0d06b00d4703dd6d18849e5bb40f729c91be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
#
# Calculate the Lx & Fx data.
#
# Based on 'loop_lx.sh', but only process one source
#
# Weitian LI
# 2013-10-30
#
full_path=`readlink -f $0`
base_dir=`dirname $full_path`
if [ $# -lt 2 ]; then
printf "usage:\n"
printf " `basename $0` <global.cfg> [c] < 500 | 200 > ...\n"
exit 1
fi
cfg_file="$1"
pre_results="final_result.txt"
case "$2" in
[cC]*)
F_C="YES"
shift
;;
*)
F_C="NO"
;;
esac
shift
echo "delta: $@" # 'printf' not work
if [ "${F_C}" = "YES" ]; then
printf "MODE: center\n"
fi
# exit
if [ ! -r "${cfg_file}" ]; then
printf "ERROR: global cfg not accessible\n"
exit 11
elif [ ! -r "${pre_results}" ]; then
printf "ERROR: previous '${pre_results}' not accessible\n"
exit 12
else
sbp_cfg=`grep '^sbp_cfg' $cfg_file | awk '{ print $2 }'`
##
for delta in $@; do
if grep -q '^beta2' $sbp_cfg; then
MODEL="dbeta"
else
MODEL="beta"
fi
rout=`grep "^r${delta}" ${pre_results} | sed -e 's/=/ /' | awk '{ print $2 }'`
if [ "${F_C}" = "YES" ]; then
lx_res="lx_result_${delta}_c.txt"
fx_res="fx_result_${delta}_c.txt"
CMD="$base_dir/calc_lxfx.sh $cfg_file $rout c"
else
lx_res="lx_result_${delta}.txt"
fx_res="fx_result_${delta}.txt"
CMD="$base_dir/calc_lxfx.sh $cfg_file $rout"
fi
[ -e "${lx_res}" ] && mv -f ${lx_res} ${lx_res}_bak
[ -e "${fx_res}" ] && mv -f ${fx_res} ${fx_res}_bak
${CMD}
mv -f lx_result.txt ${lx_res}
mv -f fx_result.txt ${fx_res}
done
fi
exit 0
|