From d861a9a030e1d1ee21ff6952d5102349e102aebe Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Tue, 21 Mar 2023 20:52:35 +0000 Subject: [PATCH] start work on lm1-dailies.py script. The script can process on file and create plot (HTML file) but the aim is to have the script cycle through all the daily files (for Light Meter 1) and produce charts of each one. --- lm1-dailies.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lm1-dailies.py diff --git a/lm1-dailies.py b/lm1-dailies.py new file mode 100644 index 0000000..37bfdb5 --- /dev/null +++ b/lm1-dailies.py @@ -0,0 +1,40 @@ +from bokeh.plotting import figure, output_file, save, show +from bokeh.models import Legend, ColumnDataSource +import bokeh.palettes +import pandas as pd +import numpy as np +import random + +def random_colour(): + r = random.randint(0,255) + g = random.randint(0,255) + b = random.randint(0,255) + rgb = [r,g,b] + return rgb + +file_path = "data/light-meter-1/2021-06-17.csv" +single_file = pd.read_csv (file_path, sep="," ,header=None, + index_col=False, dtype='unicode') +file_data = single_file.values[1:] +# print(file_data) + +p = figure(title="Readings for Light Meter 1 (Andy) on INSERT DATE HERE", + x_axis_label="Date", + y_axis_label="Reading", + x_axis_type='datetime', + sizing_mode="stretch_both") +p.axis.major_label_text_font_size = "12px" +p.axis.major_label_standoff = 10 + +x_raw_vals = [] +y_vals = [] +for row in file_data : + x_raw_vals.append(row[0]) + y_vals.append(row[1]) + +x_vals = pd.to_datetime(x_raw_vals) +p.line(x = x_vals, y = y_vals, line_width = 2) + +output_file("output/lm1-INSERT-DATE-HERE.html", + title="Light Meter 1: INSERT DATE HERE") +save(p)