summaryrefslogtreecommitdiffstats
path: root/funtools/funtest/tfunview
blob: 93f4710f9fa76ce0c41c5c819d98ab5d193e1ccb (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/sh
#set -x

rm -f tview.fits tview.fit
ln -s $HOME/data/snr.ev tview.fits
ln -s $HOME/data/snr.ev tview.fit

FUN_VIEWFILE=./funtools1.vu
export FUN_VIEWFILE

PLATFORM=`uname`
VERBOSE=0
OPROG=../fundisp
NPROG=../fundisp
STDIN=/dev/null
# DIR=../txt/

while [ x"$1" != x ]; do
  case $1 in
  -1)
    DO1=YES
    shift
    continue;;
  -f)
    shift
    FUN_VIEWFILE=$1
    export FUN_VIEWFILE
    shift
    continue;;
  -n)
    shift
    NPROG=$1
    shift
    continue;;
  -o)
    shift
    OPROG=$1
    shift
    continue;;
  -p)
    shift
    STDIN=$1
    if [ x`echo $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
      NFILE=stdin.gz
    else
      NFILE=stdin
    fi
    shift
    continue;;
  -P)
    DO1=YES
    OPROG=../fundisp.pure
    NPROG=../fundisp.pure
    shift
    continue;;
  -v)
    VERBOSE=1
    shift
    continue;;
  -V)
    VERBOSE=2
    shift
    continue;;
  *)
    shift
    continue;;
  esac
done

echo "OPROG   ="${OPROG}
echo "NPROG   ="${NPROG}
echo "VIEWFILE="${FUN_VIEWFILE}

IFS="	"
while read ARG1 ARG2 ARG3; do
  if [ x"$ARG1" = x ]; then
    continue
  fi
  if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
    continue
  fi
  CMD=$ARG1
# ARG2=${DIR}${ARG2}
# ARG3=${DIR}${ARG3}
  if [ x$CMD = xZIEXACT ]; then
    if [ x$FILTER_PAINT = xtrue ]; then
      continue
    else
      CMD=EXACT
    fi
  fi
  if [ x$CMD = xZEXACT ]; then
    if [ x$FILTER_PAINT = xtrue ]; then
      CMD=SUM
    else
      CMD=EXACT
    fi
  fi
  case $CMD in
  OPROG)
    OPROG=$ARG2
    echo OPROG="${OPROG}"
    ;;
  NPROG)
    NPROG=$ARG2
    echo NPROG="${NPROG}"
    ;;
  EXIT)
    exit
    ;;
  EXACT|SUM|REV)
    if [ x"$DO1" = xYES ]; then
      echo "${M}DO1: $ARG2"
      eval $OPROG $ARG2 > fundisp1.out
    else
      echo "${M}EXACT: $ARG2 ... $ARG3"
      CMP=yes
      XPROG=""
      eval $OPROG $ARG2 > tfundisp1.out
      if test $? -ne 0; then
        CMP=no
        XPROG="$OPROG"
      fi
      eval $NPROG $ARG3 > tfundisp2.out
      if test $? -ne 0; then
        CMP=no
        XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
      fi
      if [ x"$CMP" = xyes ]; then
        if [ x"$ZBUG" = xtrue ]; then
          sed "/^ *$X      $Y.*$/d" < tfundisp1.out > fundisp1.out
          sed "/^ *$X      $Y.*$/d" < tfundisp2.out > fundisp2.out
        else
          mv tfundisp1.out fundisp1.out
          mv tfundisp2.out fundisp2.out
        fi
        diff fundisp1.out fundisp2.out
      else
        echo "skipping compare due to errors in $XPROG"
      fi
    fi
    echo " "
    ;;
  *)
    echo "ERROR: unknown command: $CMD"
    exit 1
    ;;
  esac
  if [ $VERBOSE = 1 ]; then
    echo "***** fundisp1.out *****"
    cat fundisp1.out
  fi
  if [ $VERBOSE = 2 ]; then
    echo "***** fundisp1.out *****"
    cat fundisp1.out
    echo "***** fundisp2.out *****"
    cat fundisp2.out
  fi
  rm -f err.log
done

rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
rm -f tview.fits tview.fit