def thickness_uniformity(c_thickness_stats, l_thickness_stats, r_thickness_stats, cu1_measured, cu1_accepted, meco_c_thickness, cl): p4a = figure(plot_width=700, plot_height=400, title="Meco Thickness Comparison") c_measurements = [1,2,3,4,5,6,7,8] l_measurements = [1,5,8] r_measurements = [1,5,8] #Center thickness p4a.line(c_measurements, c_thickness_stats, line_width=2, legend='Center') p4a.circle(c_measurements, c_thickness_stats, fill_color='white', size=8) #Left thickness p4a.line(l_measurements, l_thickness_stats, line_width=2, legend='Left', color='orange') p4a.circle(l_measurements, l_thickness_stats, fill_color='white', size=8) #Right thickness p4a.line(r_measurements, r_thickness_stats, line_width=2, legend='Right', color='purple') p4a.circle(r_measurements, r_thickness_stats, fill_color='white', size=8) #Total number of measured grids p4a.line(c_measurements, c_thickness_stats, line_width=2, legend='Total Measured: ' + str(cu1_measured), color='green') #Sampling Percentage p4a.line(c_measurements, c_thickness_stats, line_width=2, legend='Total Accepted: ' + str(len(cu1_accepted)), color='green') p4a.xaxis.axis_label = 'Measurement Number' p4a.yaxis.axis_label = 'Thickness (mm)' #Normalize Center Thicknesses normalized_thickness = statfunctions.normalize(meco_c_thickness) n_thickness_stats = statfunctions.liststats(normalized_thickness, cl) p4b = figure(plot_width=700, plot_height=400, title="Center Thickness Control (Normalized)") p4b.line(c_measurements, n_thickness_stats['avg'], line_width=2, legend='Center') p4b.circle(c_measurements, n_thickness_stats['avg'], fill_color='white', size=8) #STD lines p4b.line(c_measurements, n_thickness_stats['ucl'], line_width=1, line_color='red', legend='2 Std Lines') p4b.line(c_measurements, n_thickness_stats['lcl'], line_width=1, line_color='red') p4b.xaxis.axis_label = 'Measurement Number' p4b.yaxis.axis_label = 'Thickness (mm)' return (p4a, p4b)
##################################################################################### #IV. Retrieve data From Pandas to be used in Bokeh cu1_ids = list(cu12_df[cu12_df['tool'] == 1].id) cu1_weights = list(cu12_df[cu12_df['tool'] == 1].weight) cu1_stats = statfunctions.stats(cu1_weights) cu2_ids = list(cu12_df[cu12_df['tool'] == 2].id) cu2_weights = list(cu12_df[cu12_df['tool'] == 2].weight) cu2_stats = statfunctions.stats(cu2_weights) m_ids = list(meco_df.id) m_weights = list(meco_df.weight) m_stats = statfunctions.stats(m_weights) c_thickness_stats = statfunctions.liststats(meco_c_thickness) l_thickness_stats = statfunctions.liststats(meco_l_thickness) r_thickness_stats = statfunctions.liststats(meco_r_thickness) ###################################################################################### #V. Start Bokeh Plotting first_items = first.split('/') first_date = first_items[1] + '-' + first_items[0] + '-' + first_items[2] last_items = last.split('/') last_date = last_items[1] + '-' + last_items[0] + '-' + last_items[2] if first_date == last_date: output_file(first_date + '.html', title=first_date) else: output_file(first_date + ' to ' + last_date + '.html', title=first_date + ' to ' + last_date)
##################################################################################### #Format Pandas df into list to be used in Bokeh cu1_ids = list(cu12_df[cu12_df['tool'] == 1].id) cu1_weights = list(cu12_df[cu12_df['tool'] == 1].weight) cu1_stats = statfunctions.stats(cu1_weights) cu2_ids = list(cu12_df[cu12_df['tool'] == 2].id) cu2_weights = list(cu12_df[cu12_df['tool'] == 2].weight) cu2_stats = statfunctions.stats(cu2_weights) m_ids = list(meco_df.id) m_weights = list(meco_df.weight) m_stats = statfunctions.stats(m_weights) c_thickness_stats = statfunctions.liststats(meco_c_thickness) l_thickness_stats = statfunctions.liststats(meco_l_thickness) r_thickness_stats = statfunctions.liststats(meco_r_thickness) ###################################################################################### #Start Bokeh Plotting first_items = first.split('/') first_date = first_items[1] + '-' + first_items[0] + '-' + first_items[2] last_items = last.split('/') last_date = last_items[1] + '-' + last_items[0] + '-' + last_items[2] if first_date == last_date: output_file(first_date + '.html', title=first_date) else: output_file(first_date + ' to ' + last_date + '.html', title=first_date + ' to ' + last_date)
###################################################################################### #Cu1 Plot cu1_stats = statfunctions.stats(cu1_weight, cl) p1 = graph_functions.create_histogram(cu1_stats['avg'], cu1_stats['std'], cu1_weight, 50, 1.2, 1.6, cu1_accepted, t1_failure_pos) ###################################################################################### #Cu2 Plot cu2_stats = statfunctions.stats(cu2_weight, cl) p2 = graph_functions.create_histogram(cu2_stats['avg'], cu2_stats['std'], cu2_weight, 50, .2, .55, cu2_accepted, t2_failure_pos) ###################################################################################### #Meco GridThicknesses ###################################################################################### #p3 = graph_functions.thickness_uniformity(statfunctions.liststats(meco_c_thickness, cl)['avg'], statfunctions.liststats(meco_l_thickness, cl)['avg'], statfunctions.liststats(meco_r_thickness, cl)['avg'], cu1_measured, cu1_accepted, meco_c_thickness, cl)[0] c_thickness_stats = statfunctions.liststats(meco_c_thickness, cl) l_thickness_stats = statfunctions.liststats(meco_l_thickness, cl) r_thickness_stats = statfunctions.liststats(meco_r_thickness, cl) p4a = figure(plot_width=700, plot_height=400, title="Meco Thickness Comparison") c_measurements = [1,2,3,4,5,6,7,8] l_measurements = [1,5,8] r_measurements = [1,5,8] #Center thickness p4a.line(c_measurements, c_thickness_stats['avg'], line_width=2, legend='Center') p4a.circle(c_measurements, c_thickness_stats['avg'], fill_color='white', size=8) #Left thickness p4a.line(l_measurements, l_thickness_stats['avg'], line_width=2, legend='Left', color='orange') p4a.circle(l_measurements, l_thickness_stats['avg'], fill_color='white', size=8) #Right thickness p4a.line(r_measurements, r_thickness_stats['avg'], line_width=2, legend='Right', color='purple')
##################################################################################### #Format Pandas df into list to be used in Bokeh cu1_ids = list(cu12_df[cu12_df['tool'] == 1].id) cu1_weights = list(cu12_df[cu12_df['tool'] == 1].weight) cu1_stats = statfunctions.stats(cu1_weights) cu2_ids = list(cu12_df[cu12_df['tool'] == 2].id) cu2_weights = list(cu12_df[cu12_df['tool'] == 2].weight) cu2_stats = statfunctions.stats(cu2_weights) m_ids = list(meco_df.id) m_weights = list(meco_df.weight) m_stats = statfunctions.stats(m_weights) c_thickness_stats = statfunctions.liststats(meco_c_thickness) l_thickness_stats = statfunctions.liststats(meco_l_thickness) r_thickness_stats = statfunctions.liststats(meco_r_thickness) ###################################################################################### #Start Bokeh Plotting first_items = first.split('/') first_date = first_items[1] + '-' + first_items[0] + '-' + first_items[2] last_items = last.split('/') last_date = last_items[1] + '-' + last_items[0] + '-' + last_items[2] if first_date == last_date: output_file(first_date + '.html', title=first_date) else: output_file(first_date + ' to ' + last_date + '.html',