-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevelsgraph.sh
More file actions
81 lines (68 loc) · 1.69 KB
/
levelsgraph.sh
File metadata and controls
81 lines (68 loc) · 1.69 KB
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
#!/bin/bash
if [ "$1" == pdf ] || [ "$1" == png ]; then
comm[1]="set terminal ${1} fsize 6 monochrome"
if [ ! -f "$2" ]; then
comm[2]="set output \"${2}.${1}\""
else
comm[2]="set output \"default_output.${1}\""
fi
elif [ "$1" == x11 ]; then
comm[1]="set terminal x11"
elif [ "$1" == ps2pdf ]; then
comm[1]="set terminal postscript clip"
comm[5]="set size 0.6 , 1"
if [ ! -f "$2" ]; then
PSFILE="${2}.ps"
comm[2]="set output \"${2}.ps\""
else
PSFILE="default_output.ps"
comm[2]="set output \"default_output.ps\""
fi
fi
#now make plots for all inputs
for i in "$@"; do
if [ -f "$i" ]; then
if [ ! "$command" == "" ]; then
command="${command},"
fi
if [ "$command" == "" ]; then
command="plot "
fi
title=$i
if [ ! -f "$3" ]; then
comm[3]=$3
fi
#title="N = `echo $i | cut -d_ -f 5 | cut -dn -f 2`"
title=`echo $i | cut -d_ -f 3,6 \
| sed 's/cd/Cube depth = /' \
| sed 's/L/Transform levels = /' \
| sed 's/_/, file = /'`
#title=""
command="${command} \"${i}\" using (\$6):(\$10) with linespoints title \"${title}\""
#command="${command} \"${i}\" using (\$6):(\$1\>50?) pt 1 with points title \"${title}\""
fi
done
TITLE=""
comm[4]="set ylabel \"YCbCr PSNR [dB]\"; set xlabel \"Packet skip ratio\"; set title \"${TITLE}\""
#theta(t) = theta0 + a * exp(-t / tau) * sin(2 * pi * t / T + phi)
#a = 40
#tau = 15
#phi = -0.5
#T = 15
#theta0 = 10
#fit theta(x) "${i}" using 1:2:3 via a, tau, phi, T, theta0
#, theta(x)
gnuplot -persist <<EOF
#set logscale y
#set datafile separator ","
${comm[1]}
${comm[2]}
${comm[4]}
${comm[5]}
${command}
EOF
if [ ! -z "$PSFILE" ]; then
ps2pdf $PSFILE
PDFFILE=`echo $PSFILE | sed 's/.ps/.pdf/'`
pdfcrop $PDFFILE $PDFFILE
fi