-
Notifications
You must be signed in to change notification settings - Fork 18
/
proc_tdoa_kiwi.sh
executable file
·50 lines (42 loc) · 1.52 KB
/
proc_tdoa_kiwi.sh
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
#!/bin/bash
## TDoA reprocessing using kiwiproxy data
## log files: $FILES_PATH/"num".log
## example: FILES_PATH="path to files" ./proc_tdoa_kiwi.sh num1 num2 ...
FILES_PATH=${FILES_PATH-../files} ## default is ../files
function do_proc {
local r=$1
local fs=$(find ${FILES_PATH}/$r -name "*.wav" -print)
local ff=""
for f in $fs; do
ff="'$f',$ff"
done
ff="{${ff:0:-1}}"
local dir="'${FILES_PATH}/$r'"
rm -f ${FILES_PATH}/$f/status.json
local west=$(cat ${FILES_PATH}/$r/*json | awk '/west/{print 1*$2}' | sort -rn | tail -1)
local south=$(cat ${FILES_PATH}/$r/*json | awk '/south/{print 1*$2}' | sort -rn | tail -1)
local east=$(cat ${FILES_PATH}/$r/*json | awk '/east/{print 1*$2}' | sort -n | tail -1)
local north=$(cat ${FILES_PATH}/$r/*json | awk '/north/{print 1*$2}' | sort -n | tail -1)
if [ X$west == X ] || [ X$south == X ] || [ X$north == X ] || [ X$east == X ]; then
echo "no maps found"
return
fi
local plot_info="struct('lat_range', [$south $north],'lon_range', [$west $east])"
echo $dir, $ff, $plot_info
DISPLAY= QT_X11_NO_MITSHM=1 octave-cli --eval "proc_tdoa_kiwi($dir, $ff, $plot_info);"
echo exitcode=$?
## jsonlint-php ${FILES_PATH}/$r/status.json
jq . ${FILES_PATH}/$r/status.json
}
n=$(echo $@ | wc -w)
counter=0
for r in $@; do
counter=$((1 + $counter))
echo $r $counter/$n
do_proc $r 2>&1 > ${FILES_PATH}/$r.log &
if [ $(( $counter %4 )) == 0 ]; then
wait
counter=0
fi
wait
done