Data processing and plotting for 'Personal Flash' artworks. https://www.nicolaellisandritherdon.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

57 lines
2.2 KiB

from bokeh.plotting import figure, output_file, save, show
from bokeh.models import Legend, ColumnDataSource
# import datetime
from datetime import datetime
import re
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
for month in range(6, 8, 1) :
for day in range(0, 31, 1) :
p = figure(x_axis_label="Reading Id. (not same as database)",
y_axis_label="Light Reading",
sizing_mode="stretch_both")
p.axis.major_label_text_font_size = "12px"
p.axis.major_label_standoff = 10
for meter in range(1, 3) :
if (day < 10) :
d = f"0{day}"
else :
d = day
15
if (day <= 13) :
print(f"Skipping: 2021-0{month}-{d} -- missing data...")
else :
print(f"PROCESSING: 2021-0{month}-{day} for Meter {meter}...")
file_data = []
file_path = f"data/light-meter-{meter}/2021-0{month}-{d}.csv"
single_file = pd.read_csv (file_path, sep="," ,header=None,
index_col=False, dtype='unicode')
file_data.append(single_file.values[1:])
counter = 0
for row in file_data :
x_vals = []
y_vals = []
for data in row :
# print(f"Counter: {counter}")
x_vals.append(counter)
y_vals.append(data[1])
counter += 1
p.line(x = np.asarray(x_vals).astype(int),
y = np.asarray(y_vals).astype(int),
legend_label=f"Meter: {meter}",
line_color=random_colour())
counter = 0
p.title = f"Side-by-Side Comparison: 2021-0{month}-{day}"
output_file(f"output/side-by-side-day-0{month}-{d}.html",
title=f"Side-by-Side Comparison: 2021-0{month}-{d}")
save(p)