New sleepmon statistics
[mirrors/Programs.git] / c / goertzel / sleepplot.sh
CommitLineData
7cd5c7da
TM
1#!/bin/bash
2
3test -z "$1" && {
4 echo "Usage: $0 sleeplog.txt"
5 exit 23
6}
7
6c573755 8#Approximate size of graph
7cd5c7da
TM
9size="$(tail -n 1 "$1" | cut -d . -f 1)"
10test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods
78c13195 11size="$(( 600 + $size ))"
7cd5c7da 12
6c573755 13#Plot it
7cd5c7da
TM
14gnuplot << EOF
15set output "$1.png"
6c573755 16set terminal png size $size,300
7cd5c7da
TM
17
18set title "Sleep motions"
19set xlabel "time"
20set ylabel "motion"
21
6c573755 22set yrange [-0.5:3]
7cd5c7da
TM
23
24set xdata time
25set timefmt "%s"
26#set format x "%H:%M:%S"
27
7cd5c7da
TM
28set grid
29
30#set pointsize 0.5
3e5828b5 31plot "$1" using 2:5 title "Sensor state" with steps,\
720d982e
TM
32"" using 2:(\$6*3) title "Avg last last 10 seconds" with lines,\
33"" using 2:(\$7*3) title "Avg last last 30 seconds" with lines,\
34"" using 2:(\$8*3) title "Avg last last 120 seconds" with lines\
7cd5c7da
TM
35
36EOF
37
38
39
40
This page took 0.109558 seconds and 4 git commands to generate.