-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_mcs_comparison.py
72 lines (52 loc) · 2.12 KB
/
plot_mcs_comparison.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import matplotlib.pyplot as plt
import csv
import numpy as np
import re
##############################################################################################################
# Configuration #
##############################################################################################################
DIR_1 = "MU-MIMO-Characterization/2SS_Characterization/Default-Image/MU-Enabled"
FILE_NAME_1 = "3MU_2SS-end.dat"
LABEL_1 = "Default"
DIR_2 = "MU-MIMO-Characterization/2SS_Characterization/MuseRC-Image/"
FILE_NAME_2 = "3MU_2SS-end.dat"
LABEL_2 = "MuseRate"
COLOR_1 = "#8899ff"
COLOR_2 = "#ff9922"
TITLE = ""
XTICKS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
BAR_WIDTH = 0.25
BAR_SPACING = 0.05
##############################################################################################################
def getmcs(filename, DIR):
f = open(DIR + "/" + filename)
mcs = []
for line in f:
if "VHT Tx TxBF counts(0..9)" in line:
mcs = line.split(":")[1].split(",")
for i in range(len(mcs)):
if len(mcs[i]) == 0:
mcs.remove(i)
else:
mcs[i] = int(mcs[i])
# Normalize MCS Counts
total = sum([i for i in mcs])
mcs = [float(i)/float(total) for i in mcs]
return mcs
##############################################################################################################
mcs_1 = getmcs(FILE_NAME_1, DIR_1)
mcs_2 = getmcs(FILE_NAME_2, DIR_2)
print mcs_1
print mcs_2
N = 10
ind = np.array(range(N)) # the x locations for the groups
plt.style.use("ggplot")
p1 = plt.bar(ind, [mcs_1[j] for j in range(N)], BAR_WIDTH, color=COLOR_1)
p2 = plt.bar(ind+BAR_WIDTH+BAR_SPACING, [mcs_2[j] for j in range(N)], BAR_WIDTH, color=COLOR_2)
plt.ylabel('Ratio')
plt.xlabel('MCS')
plt.title(TITLE)
plt.xlim(-BAR_SPACING, (N-1) + 2*(BAR_WIDTH+BAR_SPACING))
plt.xticks(ind + BAR_SPACING/2.0 + BAR_WIDTH, (XTICKS))
plt.legend((p1, p2), (LABEL_1, LABEL_2), loc = "upper left")
plt.show()