In [41]:
import os
from os.path import join
AllFile = []
dest = "F:\\data\\newData"
for root, dirs, files in os.walk( dest ):
for OneFileName in files :
OneFullFileName = join( root, OneFileName )
AllFile.append(OneFullFileName)
print(AllFile)
In [42]:
# firstData = []
secondData = []
# for i in AllFile:
# if(len(i)==26):
# firstData.append(i)
# else:
# secondData.append(i)
for i in AllFile:
secondData.append(i)
In [43]:
# firstData
In [44]:
secondData
Out[44]:
In [45]:
# def read_dta(dta):
# """read the dta file and return numerical array"""
# with open(dta) as f:
# newData = []
# data = f.readlines()
# for i in data[6:]:
# newData.append(float(i[0:6]))
# return newData
In [46]:
# datatest = read_dta(secondData[1])
In [47]:
# def getPIValue(data):
# PIValue = []
# for j in range(9):
# upT = 0
# downT = 0
# for i in range(0+j*1200,1200+j*1200):
# if (data[i]>1488 and data[i]<2000) or (data[i]>2516 or data[i] <976):
# upT+=1
# else:
# downT+=1
# print(upT)
# print(downT)
# print(upT+downT)
# PIValue.append((upT-downT)/(upT+downT))
# return PIValue
In [48]:
# firstDataPIValue = []
# for i in firstData:
# data = read_dta(i)
# PI = getPIValue(data)
# firstDataPIValue.append(PI)
# print(firstDataPIValue)
In [49]:
# for i in range(9):
# firstDataPIValue[4][i] = -firstDataPIValue[4][i]
# for i in firstDataPIValue:
# print(i)
In [51]:
secondPIValue=[]
for i in secondData:
temp = []
with open(i) as f:
newData = []
data = f.readlines()
for j in data[5][13:-2].split(","):
temp.append(float(j))
secondPIValue.append(temp)
print(secondPIValue)
In [ ]:
In [12]:
# firstDataPIValue
Out[12]:
In [53]:
firstDataPIValue=[]
for i in secondPIValue:
firstDataPIValue.append(i)
In [54]:
firstDataPIValue
Out[54]:
In [56]:
for i in firstDataPIValue:
print(i)
In [17]:
# for i in range(9):
# firstDataPIValue[18][i] = -firstDataPIValue[18][i]
In [ ]:
In [57]:
import pandas as pd
data = {i:firstDataPIValue[i] for i in range(len(firstDataPIValue))}
pdData = pd.DataFrame(data)
pdData
Out[57]:
In [58]:
s = pdData.T.describe()
In [59]:
s
Out[59]:
In [60]:
import matplotlib.pyplot as plt
plt.figure(figsize=(10,8), dpi=80)
name_list = ['test','test','tr','tr','test','tr','tr','test','test']
num_list = s.loc["mean"]
yerr = s.loc["std"]/np.sqrt(s.iloc[0,0])
plt.bar(range(len(num_list)), num_list,tick_label=name_list,color=['c','c','seagreen','seagreen','c','seagreen','seagreen','c','c'])
plt.xlabel("Sequence")
plt.ylabel("Performance Index")
plt.title("PI Figure")
plt.ylim(-0.6,0.8)
#plt.errorbar([i for i in range(9)],num_list,yerr=yerr,fmt="b",color="teal")
plt.errorbar([i for i in range(9)],num_list,yerr=yerr,ls='none',fillstyle='none',ms=9,mew=1.3,color='r')
plt.grid(color="grey",linewidth='0.1')
plt.show()
In [61]:
import numpy as np
fig = plt.figure(0)
x = np.arange(10.0)
y = np.sin(np.arange(10.0) / 20.0 * np.pi)
plt.errorbar(x, y, yerr=0.1)
y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 1
plt.errorbar(x, y, yerr=0.1, uplims=True)
y = np.sin(np.arange(10.0) / 20.0 * np.pi) + 2
upperlimits = np.array([1, 0] * 5)
lowerlimits = np.array([0, 1] * 5)
plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits)
plt.xlim(-1, 10)
plt.show()