WIP: attempt to continue getting data separately from web stuff

This commit is contained in:
Brendan Haines 2020-03-02 16:13:37 -07:00
parent 84e987ee8f
commit 84cab79c1b

View File

@ -55,21 +55,19 @@ plot = figure(plot_height=400, plot_width=400, title="Reflectivity",
plot.line('x', 'y', source=plt_source, line_width=3, line_alpha=0.6) plot.line('x', 'y', source=plt_source, line_width=3, line_alpha=0.6)
def update_data(attrname=None, old=None, new=None): def update_plot(attrname=None, old=None, new=None):
brightness = [get_normalized_reflectivity(c) for c in range(8)] brightness = [get_normalized_reflectivity(c) for c in range(8)]
plt_source.data = dict(x=brightness_idx, y=brightness) plt_source.data = dict(x=brightness_idx, y=brightness)
def cal_white(attrname=None, old=None, new=None): def cal_white(attrname=None, old=None, new=None):
global white_cal global white_cal
white_cal = [get_reflectivity(c) for c in range(8)] white_cal = [get_reflectivity(c) for c in range(8)]
print(white_cal) update_plot()
update_data()
def cal_black(attrname=None, old=None, new=None): def cal_black(attrname=None, old=None, new=None):
global black_cal global black_cal
black_cal = [get_reflectivity(c) for c in range(8)] black_cal = [get_reflectivity(c) for c in range(8)]
print(black_cal) update_plot()
update_data()
cal_white_button = Button(label="Cal White") cal_white_button = Button(label="Cal White")
cal_white_button.on_click(cal_white) cal_white_button.on_click(cal_white)
@ -85,7 +83,8 @@ curdoc().title = "test"
def control_thread(): def control_thread():
while True: while True:
time.sleep(0.01) time.sleep(0.01)
update_data() brightness = [get_normalized_reflectivity(c) for c in range(8)]
print(brightness)
t = threading.Thread(target=control_thread) t = threading.Thread(target=control_thread)
t.start() t.start()