move some stuff around

This commit is contained in:
Brendan Haines 2020-03-02 21:06:44 -07:00
parent 7f2e8498a6
commit fa6a1b1d30

View File

@ -42,13 +42,6 @@ servos[2].throttle = 0
white_cal = [0]*8 white_cal = [0]*8
black_cal = [5]*8 black_cal = [5]*8
# Initialize Brightness
brightness_idx = np.arange(8)
brightness = [get_normalized_reflectivity(c) for c in range(8)]
# Initialize Log
time_data = np.empty((0, 3)) # [[t, e, c]]
def get_reflectivity(chan): def get_reflectivity(chan):
global mux_io global mux_io
global adc_mux global adc_mux
@ -67,6 +60,13 @@ def get_normalized_reflectivity(chan):
global black_cal global black_cal
return (get_reflectivity(chan) - black_cal[chan]) / (white_cal[chan] - black_cal[chan]) return (get_reflectivity(chan) - black_cal[chan]) / (white_cal[chan] - black_cal[chan])
# Initialize brightness data
brightness_idx = np.arange(8)
brightness = [get_normalized_reflectivity(c) for c in range(8)]
# Initialize time data
time_data = np.empty((0, 3)) # [[t, e, c]]
# Create sources for plots # Create sources for plots
brightness_plot_source = ColumnDataSource(data=dict(sensor=brightness_idx, brightness=brightness)) brightness_plot_source = ColumnDataSource(data=dict(sensor=brightness_idx, brightness=brightness))
time_plot_source = ColumnDataSource(data=dict(t=time_data[:,0], e=time_data[:,1], c=time_data[:,2])) time_plot_source = ColumnDataSource(data=dict(t=time_data[:,0], e=time_data[:,1], c=time_data[:,2]))