VT Value Distribution and Trend Analysis for Different Time Nodes
Step 1: Plot the distribution of VT values for each time node
import numpy as np
import matplotlib.pyplot as plt
import os
import math
import time
path = '.\readvt\log\'
# path = '.\vt-32Mb-skyworth\'
path1 = '.\readvt\results\'
dir = []
abnorm = []
vrd = 6.0
files = os.listdir(path)
for i in files:
if os.path.isdir(path + i):
dir.append(i)
print(dir)
slotn = ['1']
# files = ['#1 2.log', '#3 4.log', '#5 6.log', '#7 8.log', '#9 10.log',]#,'3.log','4.log','5.log','6.log','7.log','8.log','9.log','10.log','11.log','12.log','13.log',
# '14.log','15.log','16.log','17.log','18.log','19.log','20.log','21.log','22.log','23.log','24.log','25.log',
# '26.log','27.log','28.log','29.log','30.log','31.log','32.log','33.log','34.log','35.log','36.log','37.log',
# '38.log','39.log']#,'40.log']#,'41.log','42.log','43.log','44.log','45.log','46.log','47.log','48.log','49.log',
# '50.log']#,'#101.log']
# files = ['1','2','3','4','5','6','7',
files = ['1.log','2.log','3.log','4.log','5.log','6.log','7.log','8.log','9.log','10.log','11.log','12.log','13.log','14.log','15.log','16.log','17.log'
,'18.log','19.log','20.log','21.log','22.log','23.log','24.log','25.log','26.log','27.log','28.log','29.log','30.log','31.log','32.log','33.log'
,'34.log','35.log','36.log','37.log','38.log','39.log','40.log','41.log','42.log','43.log','44.log','45.log','46.log','47.log','48.log','49.log'
,'50.log','61.log','62.log','63.log','64.log','65.log','66.log','67.log','68.log','69.log','70.log',
'71.log','72.log','73.log','74.log','75.log','76.log','77.log','78.log','79.log','80.log',
'81.log','82.log','83.log','84.log','85.log','86.log','87.log','88.log','89.log','90.log',
'91.log','92.log','93.log','94.log','95.log','96.log','97.log','98.log','99.log','100.log']
## Step 2: Plot the distribution of VT values for each time node
plt.figure(figsize=(16,8),dpi=80)
for k in dir:
files = os.listdir(path + k)
# print(files,k)
vt0_min = [] ### list store of min vt value of each dir
slot_name = []
vt_value_flt_wo0 = []
for p in slotn:
a = 'zero pattern vth worsest case:'
for i in files:
with open(path + k + '\' + i,'r',encoding='gb18030',errors='ignore') as file:
data = file.readlines()
for n in data:
if a in n:
#print(n)
vt_value_str = data[data.index(n)][31:-2]
#print(vt_value_str)
vt_value_flt_wo0.append(vt_value_str)
print(vt_value_flt_wo0,len(vt_value_flt_wo0))
vt0_min = [float(i) for i in vt_value_flt_wo0]
#slot_name.append(k+'\'+ str(i))
#min_slot=slot_name[vt0_min.index(min(vt0_min))]
print(vt0_min)
x = np.sort(vt0_min)
y = np.arange(1,len(x)+1)/len(x)
plt.yticks(np.arange(-0.05,1.05,0.05)) # set yaxis label precision
plt.plot(x,y,marker='.',linestyle=':',label='%s %d pcs min vt=%f'%(k,len(vt0_min),min(vt0_min)))
plt.annotate(min(vt0_min),(min(vt0_min),1/len(vt0_min)))
# plt.annotate('Vrd=%s'%vrd,(vrd+0.05,0.5))
#plt.annotate(vt0_min[int(len(vt0_min)/2)],(vt0_min[int(len(vt0_min)/2)],0.5))#1/int(len(vt0_min)/2)))
#plt.subplots_adjust(left=0.18, wspace=0.25, hspace=0.25,bottom=0.13, top=0.91)
# plt.axvline(x=vrd,ls='-',c='red')
plt.margins(x=0.5, y=0.05)
plt.xlabel('vt value last not 0 count')
plt.ylabel('cumulative probability')
plt.legend(loc='lower right',fontsize='small')#'best'
plt.tight_layout()
plt.grid(b=bool)
plt.title('vt distribution')
#plt.show()
t = time.strftime('%Y%m%d-%H%M',time.localtime(time.time()))
plt.tight_layout()
plt.savefig(path1+'min_vt_value_distribution.png')
#plt.savefig(path2+'vtdistr.png')
plt.close()
Step 3: Plot the trend of min vt value over time
plt.figure(figsize=(16,8),dpi=80)
vt0_min_all = []
for k in dir:
files = os.listdir(path + k)
vt0_min = [] ### list store of min vt value of each dir
slot_name = []
vt_value_flt_wo0 = []
for p in slotn:
a = 'zero pattern vth worsest case:'
for i in files:
with open(path + k + '\' + i,'r',encoding='gb18030',errors='ignore') as file:
data = file.readlines()
for n in data:
if a in n:
vt_value_str = data[data.index(n)][31:-2]
vt_value_flt_wo0.append(vt_value_str)
vt0_min = [float(i) for i in vt_value_flt_wo0]
vt0_min_all.append(min(vt0_min))
plt.plot(vt0_min_all,marker='o',label='min vt value')
plt.xticks(np.arange(0,len(dir),1),dir,rotation=90)
plt.ylabel('min vt value')
plt.xlabel('time')
plt.title('Trend of min vt value over time')
plt.legend()
plt.tight_layout()
plt.grid(b=bool)
plt.savefig(path1+'min_vt_value_trend.png')
plt.close()
原文地址: https://www.cveoy.top/t/topic/oDF4 著作权归作者所有。请勿转载和采集!