def print_data(device): device.set_integration_time(100) data = device.get_line() avg_data = sum(data) / len(data) print "" points = [] values = [] subsample_size = len(data) / 72 for item in data[::subsample_size]: points.append(float(item)) values.append(None) if graph_available: gram = DGWrapper(data=[points, values]) gram.show() else: print "Min: %s Max: %s Avg: %s" % (min(data), max(data), avg_data)
def draw_graphs(spectrum_data, temp_data): """ Build the chart options at each pass, render the data to screen. """ gram_option = DOption() gram = DGWrapper(data=spectrum_data) gram.show() temp_options = DOption() temp_options.mode = "g" temp_options.palette = "red" temp_options.size = Point([0, 3]) temp_gram = DGWrapper(dg_option=temp_options, data=temp_data) temp_gram.show()