update version

This commit is contained in:
Diyu
2015-11-04 17:17:18 -08:00
committed by Bastian Bloessl
parent 39db4c91e8
commit 940a1a1ccf
2 changed files with 46 additions and 8 deletions
+39 -5
View File
@@ -5,23 +5,57 @@ import matplotlib.pyplot as plt
x= []
y= []
tmp = []
table = {}
path = "result/"
for filename in glob.glob(os.path.join(path, "*.log")):
pat = re.search(r"s(\d+.\d+)", filename)
pat = re.search(r"s([-+]?\d+.\d+)", filename)
pat2 = re.search(r"n(\d+)", filename)
pat3 = re.search(r"e(\d+)", filename)
if pat and pat2:
x.append(float(pat.group(1)))
if pat and pat2 and pat3:
receive = sum(1 for line in open(filename))
total = pat2.group(1)
encode = pat3.group(1)
y.append(receive/float(total))
tmp.append((float(pat.group(1)), receive/float(total), encode))
for a,b,c in tmp:
if c not in table:
table[c] = []
table[c].append((a,b))
print table
for c in table:
tmp = []
for a,b in table[c]:
tmp.append((a,b))
tmp = sorted(tmp, key=lambda tmp: tmp[0])
# print tmp
x = []
y = []
for a,b in tmp:
x.append(a)
y.append(b)
print x
print y
plt.plot(x,y, label = "encode " + str(c))
# plt.text(x[-1], y[-1], "encode " + str(c))
#for a,b in tmp:
# x.append(a)
# y.append(b)
#print x
#print y
plt.ylabel("PDR")
plt.xlabel("SNR")
plt.plot(x, y)
#plt.plot(x, y)
#plt.plot(x)
plt.legend()
plt.show()