From 940a1a1ccfe476662de75925da03764690426c44 Mon Sep 17 00:00:00 2001 From: Diyu Date: Wed, 4 Nov 2015 17:17:18 -0800 Subject: [PATCH] update version --- workspace/parse.py | 44 +++++++++++++++++++++++++++++++++++++++----- workspace/run | 10 +++++++--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/workspace/parse.py b/workspace/parse.py index 559682e..0c8a672 100755 --- a/workspace/parse.py +++ b/workspace/parse.py @@ -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() diff --git a/workspace/run b/workspace/run index 0ee1934..28e3aec 100755 --- a/workspace/run +++ b/workspace/run @@ -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