commit 70b87122181e069ac1045056b963f45144b0fbe5
parent 61cb4a8053f11b44b18b28557c72ad772bdecdcd
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Sun, 8 Jul 2018 18:02:40 +0000
Plot the usage statistics over the week.
Diffstat:
6 files changed, 15 insertions(+), 49 deletions(-)
diff --git a/dist/cron.daily/laundrysorcery_stats b/dist/cron.daily/laundrysorcery_stats
@@ -10,16 +10,27 @@ do
[[ $(( l[1] - l[0] )) -gt 600 ]] && echo $(date --date="@${l[0]}" +%H) " " $(( l[1] - l[0] ))
done < lslog > lshours
+while read -a l
+do
+ [[ $(( l[1] - l[0] )) -gt 600 ]] && echo $(date --date="@${l[0]}" +%u) " " $(( l[1] - l[0] ))
+done < lslog > lsweekdays
+
awk 'BEGIN{for(i=0; i<24; i++)times[i]=0}{times[$1]++}END{for(idx=0;idx<24;idx++){print(idx,times[idx])}}' lshours > lshourfreq
+awk 'BEGIN{for(i=1; i<=7; i++)times[i]=0}{times[$1]++}END{for(idx=1;idx<=7;idx++){print(idx,times[idx])}}' lsweekdays > lsweekdayfreq
gnuplot - <<-EOF
set terminal svg
set xrange [0:23]
-set output 'lshourfreq.svg'
set boxwidth 0.5
set style fill solid
set grid
set xlabel 'Hour of day'
set ylabel 'Frequency'
+set output 'lshourfreq.svg'
plot 'lshourfreq' with boxes t ''
+set xlabel 'Day of week (1=Monday)'
+set xrange [0:8]
+set yrange [0:*]
+set output 'lsweekdayfreq.svg'
+plot 'lsweekdayfreq' with boxes t ''
EOF
diff --git a/doc/Documentation.tex b/doc/Documentation.tex
@@ -156,14 +156,6 @@
\max_{i} \sigma_i &< \tau_{abs}\\
\max_{i} \frac{\sigma_i}{\mu_i} &< \tau_{rel}
\end{align}
-
- A run of this algorithm results, as an example, in the following clusters:
-
- \begin{figure}[H]
- \centering
- \includegraphics[max width=0.75\linewidth]{Graph/Clusters/Clusters.pdf}
- \caption{Clusters of the Washing Machine}
- \end{figure}
\subsection{Guessing the Remaining Time}
We now have clusters of gaussians, and want to know: How long is a washing going to take?
diff --git a/doc/Graph/Clusters/Clusters.gnuplot b/doc/Graph/Clusters/Clusters.gnuplot
@@ -1,3 +0,0 @@
-set xlabel "Cluster-ID"
-set ylabel "Dauer [h]"
-plot "cluster.txt" using 1:($2/60) t ""
diff --git a/doc/Graph/Clusters/cluster.txt b/doc/Graph/Clusters/cluster.txt
@@ -1,35 +0,0 @@
-0 819
-0 1001
-0 1012
-1 1988
-1 1964
-1 2039
-1 1896
-1 1911
-1 1933
-1 1887
-1 1921
-1 1896
-2 3541
-3 4549
-3 4927
-4 6176
-4 5518
-4 6073
-4 6158
-4 5712
-5 6712
-5 6751
-5 6596
-5 6662
-5 6446
-5 7205
-5 6517
-5 6491
-5 6445
-6 9300
-7 10332
-7 10635
-7 10245
-7 10672
-8 14612
diff --git a/doc/Makefile b/doc/Makefile
@@ -1,6 +1,6 @@
DPI=96
-Documentation.pdf: Documentation.tex Graph/simulation.pdf Graph/Cut_Gaussians/Cut_Gaussian.pdf Graph/distribution.pdf Graph/Clusters/Clusters.pdf
+Documentation.pdf: Documentation.tex Graph/simulation.pdf Graph/Cut_Gaussians/Cut_Gaussian.pdf Graph/distribution.pdf
lualatex $<
Graph/simulation.csv: Graph/simulator.m
@@ -9,7 +9,7 @@ Graph/simulation.csv: Graph/simulator.m
Graph/simulation.pdf: Graph/simulation.gnuplot Graph/simulation.csv
%.pdf: %.gnuplot
- cd $(<D);gnuplot -e "set terminal \"pdfcairo\" enhanced; set output \"$(@F)\"" $(<F)
+ gnuplot -e "set terminal \"pdfcairo\" enhanced; set output \"$@\"" $<
%.pdf: %.tex
pdflatex $<
diff --git a/www/details.html b/www/details.html
@@ -42,5 +42,6 @@
</script>
<H1>Usage Statistics</H1>
<div><img src="lshourfreq.svg" /></div>
+ <div><img src="lsweekdayfreq.svg" /></div>
</body>
</HTML>