7.0 KiB
- Overview of
lm1-hourly-totals.py
andlm2-hourly-totals.py
Scripts - Design/Trade-Off Notes and Decisions
- Files Used
- Files Produced
- What the Scripts Do
- Examples/Screenshots
Overview of lm1-hourly-totals.py
and lm2-hourly-totals.py
Scripts
I have assumed you have ran ./separator.sh
and ./totalilator.sh
, created a
virtual-environment (venv) (python3 -m venv venv
) and installed the dependencies
(via pip -r install requirements.txt
). See the project's README for more
information on setting the repository up.
cd <PATH TO RITHERDON-CHARTS>
# Activate the virtual-environment if you haven't...
source venv/bin/activate
# Run the script for generating the chart for Light Meter 1...
python lm1-hourly-totals.py
# Run the script for generating the chart for Light Meter 2...
python lm2-hourly-totals.py
Design/Trade-Off Notes and Decisions
Both scripts do the same thing but each one focuses on a particular Light Meter. I made two scripts instead of integrating both sets of data into one to make things easier for myself. These scripts were, I think, some of the first attempts and I did not know how much time I was going to spend on this project. My thinking at the time was,
This works and it's easier to copy the code and replace
1
with2
than add extra loops and conditions to the code.
If this project had more long-term aspirations, I would consolidate both scripts into one.
I did not add a legend to the charts because the list ended up running off the page when I tried it. There are too many lines plotted and the chart is difficult to read on smaller screens. Overall, the pattern produced from seeing the lines plotted on top of each other was the most important aspect for this task.
The 24
hour time-slot in the CSV files are redundant. I kept them in due to
laziness.
The exhibition ran until the 1^st August 2021 but that was a Sunday and no one, in Ritherdon, worked that day – so there were no reading taken (I.E. no data to process).
Files Used
These are the data files (I.E. the CSV files) used by both scripts.
tree ../data/light-meter-*-hourly-totals
../data/light-meter-1-hourly-totals
├── 2021-06
│ ├── 2021-06-13.csv
│ ├── 2021-06-14.csv
│ ├── 2021-06-15.csv
│ ├── 2021-06-16.csv
│ ├── 2021-06-17.csv
│ ├── 2021-06-18.csv
│ ├── 2021-06-19.csv
│ ├── 2021-06-20.csv
│ ├── 2021-06-21.csv
│ ├── 2021-06-22.csv
│ ├── 2021-06-23.csv
│ ├── 2021-06-24.csv
│ ├── 2021-06-25.csv
│ ├── 2021-06-26.csv
│ ├── 2021-06-27.csv
│ ├── 2021-06-28.csv
│ ├── 2021-06-29.csv
│ └── 2021-06-30.csv
└── 2021-07
├── 2021-07-01.csv
├── 2021-07-02.csv
├── 2021-07-03.csv
├── 2021-07-04.csv
├── 2021-07-05.csv
├── 2021-07-06.csv
├── 2021-07-07.csv
├── 2021-07-08.csv
├── 2021-07-09.csv
├── 2021-07-10.csv
├── 2021-07-11.csv
├── 2021-07-12.csv
├── 2021-07-13.csv
├── 2021-07-14.csv
├── 2021-07-15.csv
├── 2021-07-16.csv
├── 2021-07-17.csv
├── 2021-07-18.csv
├── 2021-07-19.csv
├── 2021-07-20.csv
├── 2021-07-21.csv
├── 2021-07-22.csv
├── 2021-07-23.csv
├── 2021-07-24.csv
├── 2021-07-25.csv
├── 2021-07-26.csv
├── 2021-07-27.csv
├── 2021-07-28.csv
├── 2021-07-29.csv
└── 2021-07-30.csv
../data/light-meter-2-hourly-totals
├── 2021-06
│ ├── 2021-06-13.csv
│ ├── 2021-06-14.csv
│ ├── 2021-06-15.csv
│ ├── 2021-06-16.csv
│ ├── 2021-06-17.csv
│ ├── 2021-06-18.csv
│ ├── 2021-06-19.csv
│ ├── 2021-06-20.csv
│ ├── 2021-06-21.csv
│ ├── 2021-06-22.csv
│ ├── 2021-06-23.csv
│ ├── 2021-06-24.csv
│ ├── 2021-06-25.csv
│ ├── 2021-06-26.csv
│ ├── 2021-06-27.csv
│ ├── 2021-06-28.csv
│ ├── 2021-06-29.csv
│ └── 2021-06-30.csv
└── 2021-07
├── 2021-07-01.csv
├── 2021-07-02.csv
├── 2021-07-03.csv
├── 2021-07-04.csv
├── 2021-07-05.csv
├── 2021-07-06.csv
├── 2021-07-07.csv
├── 2021-07-08.csv
├── 2021-07-09.csv
├── 2021-07-10.csv
├── 2021-07-11.csv
├── 2021-07-12.csv
├── 2021-07-13.csv
├── 2021-07-14.csv
├── 2021-07-15.csv
├── 2021-07-16.csv
├── 2021-07-17.csv
├── 2021-07-18.csv
├── 2021-07-19.csv
├── 2021-07-20.csv
├── 2021-07-21.csv
├── 2021-07-22.csv
├── 2021-07-23.csv
├── 2021-07-24.csv
├── 2021-07-25.csv
├── 2021-07-26.csv
├── 2021-07-27.csv
├── 2021-07-28.csv
├── 2021-07-29.csv
└── 2021-07-30.csv
4 directories, 96 files
Files Produced
The following files are produces after running both scripts.
ls ../output/lm*-hourly-totals.html
../output/lm1-hourly-totals.html
../output/lm2-hourly-totals.html
What the Scripts Do
Instead of individually referencing both files, I am going to write this section as if
lm1-hourly-totals.py
is the only file. Whilst reading this, assume 'lm1' and 'lm2' are interchangeable.
This script produces a line chart which depicts the total number of readings for
a given hour across every day the exhibition was running. In other words, the
chart produced will show the total number of readings taken between
08:00
-09:00
, 09:00
-10:00
and so on, for all twenty-fours of the
day. Each line in the chart represents a single day and the chart overlays each
line on top of each other.
An example of what the data files look like (used by these scripts) is
below. The data is from
data/light-meter-1-hourly-totals/2021-06/2021-06-24.csv
.
hour | reading |
---|---|
00 | 0 |
01 | 0 |
02 | 0 |
03 | 0 |
04 | 0 |
05 | 0 |
06 | 229 |
07 | 4227 |
08 | 4981 |
09 | 5057 |
10 | 8392 |
11 | 9128 |
12 | 9129 |
13 | 9039 |
14 | 8821 |
15 | 5809 |
16 | 2 |
17 | 0 |
18 | 0 |
19 | 0 |
20 | 0 |
21 | 0 |
22 | 0 |
23 | 0 |
24 | 0 |
As you can see, on the 24^th June 2021 (2021-06-24.csv
), Light Meter 1 took a
total of 229
readings between the hours of 06:00
and 07:00
. It is this 229
which
the script plots on the chart.
Examples/Screenshots
Below is an example of the type of charts produced.