update version
This commit is contained in:
+39
-5
@@ -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()
|
||||
|
||||
|
||||
+7
-3
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
for s in 5.0 10.0 15.0 20.0
|
||||
rm -rf result/*
|
||||
for e in 0 3
|
||||
do
|
||||
make n=10 c=1 s=$s o=0 e=0 i=500
|
||||
done
|
||||
for s in -5.0 5.0
|
||||
do
|
||||
make n=10 c=1 s=$s o=0 e=$e i=500
|
||||
done
|
||||
done
|
||||
./parse.py
|
||||
|
||||
Reference in New Issue
Block a user