4 echo "Usage: $0 sleeplog.txt"
9 graphout
="${in%%.*}.png"
10 test -n "$2" && graphout
="$2";
13 last
="$(tail -n 1 "$in" | cut -d ' ' -f 5)"
14 test "$last" -gt 0 && last
="motion" || last
="peace";
16 #Approximate size of graph
17 size
="$(tail -n 1 "$in" | cut -d . -f 1 | sed -e 's/^0*//' | tee /tmp/lol)"
18 test $size -gt 3600 && size
="$(( $size/10 ))" #For prolonged periods
19 size
="$(( 600 + $size ))"
23 set output "$graphout"
24 set terminal png size $size,400
26 set title "Sleep motions (current state: $last)"
34 #set format x "%H:%M:%S"
40 "$in" using 2:5 title "Sensor state" with steps,\
41 "$in.stats" using 1:((\$3*3+\$4*6+\$5*6+\$6+\$7)/5) title "Avg." smooth bezier\
42 #"" using 2:((\$6*3+\$7*6+\$8*6+\$9+\$10)/5) title "Avg." with lines,\
43 #"$in.stats" using 1:((\$3*3+\$4*6+\$5*6+\$6+\$7)/5) title "Avg." with lines,\
44 #"" using 2:(\$6*2) title "Avg. 10s" with lines,\
45 #"" using 2:(\$7*3) title "Avg. 30s" with lines,\
46 #"" using 2:(\$8*3) title "Avg. 60s" with lines,\
47 #"" using 2:(\$9*3) title "Avg. 90s" with lines,\
48 #"" using 2:(\$10*4) title "Avg. 120s" smooth bezier\
This page took 1.634529 seconds and 4 git commands to generate.