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