以同一种型号的钻头,钻21种类型的板材,每种板材使用3根钻头,分别在钻第一个孔、2001孔、4001孔和6001孔前测量钻头外径,收集数据。
1、测试方法
采用激光钻径分选机测量微钻钻径以评估微钻外径磨损,测量从钻尖起始间隔为0.02mm的16个点外径值,通过未使用微钻和使用后微钻的刃径差评估外径磨损量。
2、原始数据
2.1 d:\Documents\F1-21\new.txt
以空格间隔的21行数据,每行为一根钻头的外径数据
0.0000	0.1164	0.1525	0.1549	0.1553	0.1552	0.1551	0.1552	0.1546	0.1548	0.1545	0.1540	0.1538	0.1539	0.1543	0.1539
0.1241	0.1568	0.1572	0.1557	0.1555	0.1553	0.1555	0.1557	0.1553	0.1550	0.1548	0.1545	0.1545	0.1544	0.1543	0.1542
0.1402	0.1541	0.1555	0.1556	0.1558	0.1566	0.1583	0.1555	0.1552	0.1548	0.1548	0.1548	0.1546	0.1546	0.1546	0.1541
0.1154	0.1490	0.1537	0.1559	0.1552	0.1547	0.1548	0.1552	0.1550	0.1547	0.1543	0.1542	0.1540	0.1540	0.1539	0.1537
0.0000	0.1391	0.1534	0.1559	0.1570	0.1558	0.1557	0.1555	0.1554	0.1558	0.1564	0.1615	0.1579	0.1594	0.1630	0.1560
0.0000	0.1224	0.1516	0.1550	0.1558	0.1555	0.1558	0.1556	0.1552	0.1550	0.1548	0.1543	0.1547	0.1545	0.1546	0.1543
0.1149	0.1519	0.1543	0.1553	0.1556	0.1554	0.1552	0.1550	0.1549	0.1545	0.1544	0.1542	0.1542	0.1543	0.1542	0.1536
0.0000	0.1317	0.1602	0.1635	0.1623	0.1608	0.1558	0.1555	0.1561	0.1570	0.1551	0.1539	0.1537	0.1538	0.1539	0.1534
0.0000	0.1276	0.1520	0.1554	0.1561	0.1555	0.1555	0.1552	0.1548	0.1547	0.1546	0.1544	0.1544	0.1542	0.1543	0.1542
0.0000	0.1300	0.1583	0.1694	0.1623	0.1558	0.1557	0.1556	0.1554	0.1551	0.1546	0.1547	0.1547	0.1547	0.1549	0.1545
0.1008	0.1468	0.1546	0.1563	0.1562	0.1556	0.1556	0.1556	0.1555	0.1550	0.1550	0.1548	0.1551	0.1548	0.1549	0.1557
0.1408	0.1541	0.1559	0.1560	0.1560	0.1559	0.1561	0.1579	0.1567	0.1551	0.1551	0.1548	0.1548	0.1548	0.1548	0.1545
0.0000	0.1350	0.1532	0.1559	0.1559	0.1554	0.1552	0.1552	0.1551	0.1546	0.1547	0.1546	0.1546	0.1546	0.1543	0.1546
0.0000	0.1341	0.1532	0.1556	0.1556	0.1553	0.1552	0.1552	0.1549	0.1552	0.1554	0.1542	0.1541	0.1540	0.1542	0.1540
0.0000	0.1237	0.1515	0.1548	0.1552	0.1551	0.1550	0.1552	0.1548	0.1546	0.1541	0.1539	0.1540	0.1538	0.1540	0.1538
0.1022	0.1457	0.1539	0.1556	0.1555	0.1548	0.1550	0.1551	0.1551	0.1547	0.1545	0.1544	0.1543	0.1543	0.1541	0.1540
0.0000	0.1382	0.1541	0.1558	0.1556	0.1555	0.1554	0.1558	0.1554	0.1553	0.1551	0.1549	0.1554	0.1546	0.1548	0.1545
0.0000	0.1218	0.1517	0.1553	0.1559	0.1559	0.1556	0.1555	0.1551	0.1547	0.1549	0.1544	0.1544	0.1545	0.1542	0.1540
0.1437	0.1537	0.1552	0.1556	0.1557	0.1556	0.1556	0.1556	0.1554	0.1552	0.1550	0.1546	0.1545	0.1544	0.1540	0.1541
0.1244	0.1529	0.1591	0.1573	0.1559	0.1563	0.1558	0.1557	0.1552	0.1551	0.1547	0.1541	0.1543	0.1544	0.1544	0.1545
0.0000	0.1348	0.1531	0.1552	0.1556	0.1556	0.1556	0.1557	0.1550	0.1544	0.1544	0.1542	0.1543	0.1541	0.1543	0.1541
2.2 d:\Documents\F1-21\f21.txt
以空格为间隔的21×9行数据,21代表板材类型,9代表一种板材对应3根钻头的2K、4K、6K孔数据
3、代码绘图
from pylab import *
srcpath1=r'd:\Documents\F1-21\new.txt'
srcpath2=r'd:\Documents\F1-21\f21.txt'
def openreadtxt(file_name):
    data = []
    with open(file_name, 'r') as file:
        file_data = file.readlines()  # 读取所有行
        for row in file_data:
            tmp_list = row.split()
            tmp = [float(x) for x in tmp_list]
            data.append(tmp)  # 将每行数据插入data中
    return data
if __name__ == "__main__":
    data_new=openreadtxt(srcpath1)
    data_f21=openreadtxt(srcpath2)
    xs=np.linspace(0.02,0.32,16)
    ys_new=np.zeros(16)
    data_2k=[]
    data_4k=[]
    data_6k=[]
    for i in range(len(data_new)):
        ys_new+=np.array(data_new[i])
    ys_new=ys_new/len(data_new)
    for i in range(21):
        temp_2k = np.zeros(16)
        temp_4k = np.zeros(16)
        temp_6k = np.zeros(16)
        for j in range(9):
            if j<3:
                temp_2k+=np.array(data_f21[i*9+j])
            elif j<6:
                temp_4k+=np.array(data_f21[i*9+j])
            else:
                temp_6k+=np.array(data_f21[i*9+j])
        data_2k.append(temp_2k/3)
        data_4k.append(temp_4k/3)
        data_6k.append(temp_6k/3)
    fig=plt.figure(figsize=(5,4))
    plt.rcParams['xtick.direction'] = 'in'  # 将x周的刻度线方向设置向内
    plt.rcParams['ytick.direction'] = 'in'  # 将y轴的刻度方向设置向内
    # plt.rcParams['font.family'] = ["Times New Roman"]  # 字体设置为Times NewRoman
    plt.rcParams['font.sans-serif'] = ['SimHei']
    clist=['blue','red','green','black','slategray','lime','gold','purple','green','cyan']
    markerlst=['o','*','x','>','<','^','D','d','1','2','3','4']
    linestylelst=['-','--','-.',':','-','--','-.',':','-','--','-.',':']
    labellst=['CCL-HL832NSF','CCL-HL832NX','CCL-HL972LF','R-1515W(T)','R-1515W','R-1515A(H)','DS-7409HGB(JE)','DS-7409HGB(ZLEM)','MCL-E-700G','MCL-E-705G','MCL-E-770G','MCL-E-679FG','MCL-HS200','SI13U','SI05NR','SI07NR','SI07NR(LC)','SI10NFK','MCL-E-795G-LH','MCL-E-795G','MCL-E-705G-LH',]
    plt.plot(xs, ys_new,c=clist[9], marker=markerlst[10], markersize='10', linewidth='3', linestyle=linestylelst[10], label='New')
    out=[7,13,19,20]
    for i in range(18):
        if i in out:
            continue
        plt.plot(xs, data_6k[i], c=clist[i%10], marker=markerlst[i%12], markersize='10', linewidth='3', linestyle=linestylelst[i%12], label=labellst[i])
    plt.axhline(y=0.140,color='r',linestyle='--')
    plt.axhline(y=0.156,color='r',linestyle='--')
    font1 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 16}
    # 图例展示位置,数字代表第几象限
    plt.legend(loc=4,prop=font1,ncol=3,framealpha=0.5)
    plt.xticks(xs)
    plt.yticks(np.linspace(0.04,0.16,13))
    plt.grid(True, linestyle='--', alpha=0.5)
    plt.xlabel("到钻尖的距离/mm", fontdict={'size': 16})
    plt.ylabel("钻头外径/mm", fontdict={'size': 16})
    # plt.title("孔限为6000时的外径磨损", fontdict={'size': 20})
    fig.autofmt_xdate()
    plt.show()
    figure1 = fig.get_figure()  # 获取图形
    figure1.savefig(r"d:\Documents\1.tiff", dpi=300)




















