From afc6fd9f94616bc50b6cd4f1d034f420403a8f0f Mon Sep 17 00:00:00 2001 From: Harvie Date: Fri, 3 Aug 2012 06:23:58 +0200 Subject: [PATCH] Print current state to plot --- c/goertzel/sleepplot.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c/goertzel/sleepplot.sh b/c/goertzel/sleepplot.sh index 00d275a..0e8ed5e 100755 --- a/c/goertzel/sleepplot.sh +++ b/c/goertzel/sleepplot.sh @@ -9,6 +9,10 @@ in="$1"; graphout="${in%%.*}.png" test -n "$2" && graphout="$2"; +#Last state +last="$(tail -n 1 "$in" | cut -d ' ' -f 4)" +test "$last" -gt 0 && last="motion" || last="peace"; + #Approximate size of graph size="$(tail -n 1 "$in" | cut -d . -f 1)" test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods @@ -19,7 +23,7 @@ gnuplot << EOF set output "$graphout" set terminal png size $size,400 -set title "Sleep motions" +set title "Sleep motions (current state: $last)" set xlabel "time" set ylabel "motion" -- 2.30.2