From: Harvie Date: Fri, 3 Aug 2012 04:23:58 +0000 (+0200) Subject: Print current state to plot X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=afc6fd9f94616bc50b6cd4f1d034f420403a8f0f;p=mirrors%2FPrograms.git Print current state to plot --- 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"