Sleepcount for 300 seconds added. This is when things got riddiculously complicated...
[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
3e5828b5 8#Count events:
991ef83f
TM
9seconds='60 300'
10for i in $seconds; do
11 ./sleepcount.sh "$1" "$i" &
12done
6c573755
TM
13
14#Approximate size of graph
7cd5c7da
TM
15size="$(tail -n 1 "$1" | cut -d . -f 1)"
16test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods
78c13195 17size="$(( 600 + $size ))"
7cd5c7da 18
6c573755 19#Plot it
7cd5c7da
TM
20gnuplot << EOF
21set output "$1.png"
6c573755 22set terminal png size $size,300
7cd5c7da
TM
23
24set title "Sleep motions"
25set xlabel "time"
26set ylabel "motion"
27
6c573755 28set yrange [-0.5:3]
7cd5c7da
TM
29
30set xdata time
31set timefmt "%s"
32#set format x "%H:%M:%S"
33
7cd5c7da
TM
34set grid
35
36#set pointsize 0.5
991ef83f 37#"$1.counts.$seconds" using 1:(\$2/5) title "Activations in last $seconds seconds" smooth csplines
3e5828b5 38plot "$1" using 2:5 title "Sensor state" with steps,\
991ef83f
TM
39"$1.counts.60" using 1:(\$2/5) title "Activations in last 60 seconds" smooth csplines,\
40"$1.counts.300" using 1:(\$2/10) title "Activations in last 300 seconds" smooth csplines\
7cd5c7da
TM
41
42EOF
43
44
45
46
This page took 0.146968 seconds and 4 git commands to generate.