aboutsummaryrefslogtreecommitdiff
path: root/unittest/ota_summary.sh
blob: 5e028e36eadc946e1f10286db5b09f7befa66831 (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
#!/usr/bin/env bash
#
# Summarise tests to date

CODEC2=${HOME}/codec2

function print_help {
    echo
    echo "Automated Over The Air (OTA) data test for FreeDV OFDM HF data modems"
    echo
    echo "  usage ./ota_summary.sh [-t]"
    echo
    echo "  -t create/update thumbnail directory"
    exit 0
}

thumbnails=0
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
    -t)
        thumbnails=1
        shift
    ;;
    -h)
        print_help	
    ;;
esac
done

total_bytes=$(cat log.txt | tr -s ' ' | cut -f6 -d' ' | awk '$0==($0+0)' | paste -sd+ | bc)
printf "total bytes: %'d\n" ${total_bytes}

# collect SNR averages from log.txt and generate a histogram
ota_snrs=mktemp
cat log.txt | tr -s ' ' | cut -f7 -d' ' | awk '$0==($0+0)'| sed '/-nan/d'  > ${ota_snrs}
echo "warning('off', 'all'); \
      snr=load('${ota_snrs}'); \
      hist(snr); \
      print('snr_hist.png','-dpng'); \
      quit" | octave-cli -qf > /dev/null

# option to put small versions of spec/scatter in one dir

if [ $thumbnails -ne 0 ]; then
    mkdir -p thumbnails
    spec_files=$(find . -name spec.jpg -o -name spec.png)
    for f in $spec_files
    do
        d=$(echo $f | sed -r 's/\.(.*)\//\1_/')
        echo $f thumbnails${d}
        cp $f thumbnails${d}
    done   
fi