def read_res(file): #read data from xls files
Size, R, xr,xl,xc,yu,yd,yc = [] ,[], [],[] ,[], [],[],[] #lists for areas, Fij's, deps cordinates
out = pd.read_excel(file, sheetname = "Out") #read model results
Rout = pd.read_excel(file, sheetname = "R") #read Fij's
Sizeout = pd.read_excel(file, sheetname = "Size") #read deps wanted sizes
Wout = pd.read_excel(file, sheetname = "W") # w1 and w2
w1 = float(Wout['w1'][0])
w2 = 1.0-w1
totx = float(out['totx'][0]) #total length in x axis
toty = float(out['toty'][0]) #total length in y axis
for d in range(len(Sizeout)): #insert data results into python lists
R.append([])
Size.append(float(Sizeout['Area'][d]))
xr.append(float(out['Xr'][d]))
xl.append(float(out['Xl'][d]))
xc.append((float(out['Xl'][d])+float(out['Xr'][d]))/2)
yu.append(float(out['Yu'][d]))
yd.append(float(out['Yd'][d]))
yc.append((float(out['Yu'][d])+float(out['Yd'][d]))/2)
for i in range(len(Rout)):
R[d].append(float(Rout.iloc[d,i]))
return Size, R, totx, toty, xr,xl,xc,yu,yd,yc, w1, w2
评论列表
文章目录