Browse Source

visualiser la moyenne des dernieres mesures

master
tth 3 years ago
parent
commit
fd4da38f2a
2 changed files with 37 additions and 3 deletions
  1. +17
    -3
      viz/gnuplot/average4v.awk
  2. +20
    -0
      viz/gnuplot/plot-one.sh

+ 17
- 3
viz/gnuplot/average4v.awk View File

@ -2,16 +2,30 @@
BEGIN {
flag_debut = 1;
lastminute = 0;
cumul = 0.0;
compte = 0;
}
# iterate over all the input lines
{
if (flag_debut) {
debut = $1
flag_debut = 0
}
minutes = ($1-debut) / 60;
val = ($2 + $3 + $4 + $5) / 4.0;
print minutes, val;
minutes = int(($1-debut) / 60);
if (minutes == lastminute) {
val = ($2 + $3 + $4 + $5);
cumul += val;
compte += 4;
}
else {
val = cumul /compte;
print minutes, val;
lastminute = minutes;
cumul = 0;
compte = 0;
}
}


+ 20
- 0
viz/gnuplot/plot-one.sh View File

@ -0,0 +1,20 @@
#!/bin/bash
INFILE="../../serial/foo.dat"
NBLINES=2000
TMPFILE="/tmp/dd2data.$$"
IMAGE="average4v.png"
tail -${NBLINES} ${INFILE} | ./average4v.awk > ${TMPFILE}
gnuplot << __EOC__
set term png size 800,600
set output "${IMAGE}"
set grid
set title "Average4v"
set xlabel "minutes"
set ylabel "température"
set yrange [ 5.0 : 30.0]
plot "${TMPFILE}" with lines
__EOC__

Loading…
Cancel
Save