aboutsummaryrefslogtreecommitdiffstats
path: root/bin/get_lxfx_data.sh
blob: dbb07ddc535d56863b13d958d61d18c7cd479186 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
#
# collect data for 'loop_lx.sh' & 'calc_lxfx_simple.sh'
#

if [ $# -lt 2 ]; then
    printf "usage:\n"
    printf "    `basename $0` <dir> [c] <delta ...>\n"
    exit 1
fi

DIR="$1"
shift
case "$1" in
    [cC]*)
        F_C="YES"
        shift
        ;;
    *)
        F_C="NO"
        ;;
esac
printf "CENTER_MODE: $F_C\n"
echo "DELTA: $@"

cd $DIR
pwd -P

INFO=`ls ../*_INFO.json 2> /dev/null`
if [ ! -z "$INFO" ]; then
    OI=`grep '"Obs\.\ ID' ${INFO} | sed 's/.*"Obs.*":\ //' | sed 's/\ *,$//'`
    NAME=`grep '"Source\ Name' ${INFO} | sed 's/.*"Source.*":\ //' | sed 's/^"//' | sed 's/"\ *,$//'`
    UNAME=`grep '"Unified\ Name' ${INFO} | sed 's/.*"Unified.*":\ //' | sed 's/^"//' | sed 's/"\ *,$//'`
    Z=`grep '"redshift' ${INFO} | sed 's/.*"redshift.*":\ //' | sed 's/\ *,$//'`
fi

printf "# OI,NAME,UNAME,Z"
if [ "${F_C}" = "YES" ]; then
    for DELTA in $@; do
        printf ",L${DELTA}(bolo),L${DELTA}(0.7-7),L${DELTA}(0.1-2.4),F${DELTA}(bolo),F${DELTA}(0.7-7),F${DELTA}(0.1-2.4)"
    done
    printf "\n"
else
    for DELTA in $@; do
        printf ",L${DELTA}(bolo),L${DELTA}ERR(bolo),L${DELTA}(0.7-7),L${DELTA}ERR(0.7-7),L${DELTA}(0.1-2.4),L${DELTA}ERR(0.1-2.4),F${DELTA}(bolo),F${DELTA}ERR(bolo),F${DELTA}(0.7-7),F${DELTA}ERR(0.7-7),F${DELTA}(0.1-2.4),F${DELTA}ERR(0.1-2.4)"
    done
    printf "\n"
fi

printf "# $OI,$NAME,$UNAME,$Z"

if [ "${F_C}" = "YES" ]; then
    for DELTA in $@; do
        LX_RES="lx_result_${DELTA}_c.txt"
        FX_RES="fx_result_${DELTA}_c.txt"
        if [ -r ${LX_RES} ] && [ -r ${FX_RES} ]; then
            Lbolo=`grep '^Lx(bolo' ${LX_RES} | awk '{ print $2 }'`
            L077=`grep '^Lx(0\.7-7' ${LX_RES} | awk '{ print $2 }'`
            L0124=`grep '^Lx(0\.1-2\.4' ${LX_RES} | awk '{ print $2 }'`
            Fbolo=`grep '^Fx(bolo' ${FX_RES} | awk '{ print $2 }'`
            F077=`grep '^Fx(0\.7-7' ${FX_RES} | awk '{ print $2 }'`
            F0124=`grep '^Fx(0\.1-2\.4' ${FX_RES} | awk '{ print $2 }'`
            printf ",$Lbolo,$L077,$L0124,$Fbolo,$F077,$F0124"
        fi
    done
    printf "\n"
else
    for DELTA in $@; do
        LX_RES="lx_result_${DELTA}.txt"
        FX_RES="fx_result_${DELTA}.txt"
        if [ -r ${LX_RES} ] && [ -r ${FX_RES} ]; then
            Lbolo=`grep '^Lx(bolo' ${LX_RES} | awk '{ print $2 }'`
            LboloERR=`grep '^Lx(bolo' ${LX_RES} | awk '{ print $4 }'`
            L077=`grep '^Lx(0\.7-7' ${LX_RES} | awk '{ print $2 }'`
            L077ERR=`grep '^Lx(0\.7-7' ${LX_RES} | awk '{ print $4 }'`
            L0124=`grep '^Lx(0\.1-2\.4' ${LX_RES} | awk '{ print $2 }'`
            L0124ERR=`grep '^Lx(0\.1-2\.4' ${LX_RES} | awk '{ print $4 }'`
            Fbolo=`grep '^Fx(bolo' ${FX_RES} | awk '{ print $2 }'`
            FboloERR=`grep '^Fx(bolo' ${FX_RES} | awk '{ print $4 }'`
            F077=`grep '^Fx(0\.7-7' ${FX_RES} | awk '{ print $2 }'`
            F077ERR=`grep '^Fx(0\.7-7' ${FX_RES} | awk '{ print $4 }'`
            F0124=`grep '^Fx(0\.1-2\.4' ${FX_RES} | awk '{ print $2 }'`
            F0124ERR=`grep '^Fx(0\.1-2\.4' ${FX_RES} | awk '{ print $4 }'`
            printf ",$Lbolo,$LboloERR,$L077,$L077ERR,$L0124,$L0124ERR,$Fbolo,$FboloERR,$F077,$F077ERR,$F0124,$F0124ERR"
        fi
    done
    printf "\n"
fi