GIT.Harvie.CZ
/
mirrors
/
Programs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sleeplog format update
[mirrors/Programs.git]
/
c
/
goertzel
/
sleepplot.sh
diff --git
a/c/goertzel/sleepplot.sh
b/c/goertzel/sleepplot.sh
index 6d682a8337d7adbd4c6502098fa7a6eb0c781a67..ea0bac2ac296b138c7aedc24b22e46826723b3d4 100755
(executable)
--- a/
c/goertzel/sleepplot.sh
+++ b/
c/goertzel/sleepplot.sh
@@
-9,17
+9,21
@@
in="$1";
graphout="${in%%.*}.png"
test -n "$2" && graphout="$2";
graphout="${in%%.*}.png"
test -n "$2" && graphout="$2";
+#Last state
+last="$(tail -n 1 "$in" | cut -d ' ' -f 5)"
+test "$last" -gt 0 && last="motion" || last="peace";
+
#Approximate size of graph
#Approximate size of graph
-size="$(tail -n 1 "$in" | cut -d . -f 1)"
+size="$(tail -n 1 "$in" | cut -d . -f 1
| sed -e 's/^0*//' | tee /tmp/lol
)"
test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods
size="$(( 600 + $size ))"
#Plot it
gnuplot << EOF
set output "$graphout"
test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods
size="$(( 600 + $size ))"
#Plot it
gnuplot << EOF
set output "$graphout"
-set terminal png size $size,
3
00
+set terminal png size $size,
4
00
-set title "Sleep motions"
+set title "Sleep motions
(current state: $last)
"
set xlabel "time"
set ylabel "motion"
set xlabel "time"
set ylabel "motion"
@@
-34,9
+38,11
@@
set grid
#set pointsize 0.5
plot\
"$in" using 2:5 title "Sensor state" with steps,\
#set pointsize 0.5
plot\
"$in" using 2:5 title "Sensor state" with steps,\
-"" using 2:(\$6*
3
) title "Avg. 10s" with lines,\
+"" using 2:(\$6*
2
) title "Avg. 10s" with lines,\
"" using 2:(\$7*3) title "Avg. 30s" with lines,\
"" using 2:(\$7*3) title "Avg. 30s" with lines,\
-"" using 2:(\$8*3) title "Avg. 120s" smooth bezier\
+"" using 2:(\$8*3) title "Avg. 60s" with lines,\
+"" using 2:(\$9*3) title "Avg. 90s" with lines,\
+"" using 2:(\$10*4) title "Avg. 120s" smooth bezier\
EOF
EOF
This page took
0.122617 seconds
and
4
git commands to generate.