From 72d150db066ac702e819b94df88c0d210ddb7cd8 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 24 Mar 2023 10:37:35 +0100 Subject: [PATCH] plot --- plot/main.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plot/main.py diff --git a/plot/main.py b/plot/main.py new file mode 100644 index 0000000..2bfb0dc --- /dev/null +++ b/plot/main.py @@ -0,0 +1,47 @@ +import os +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +""" +data = pd.read_csv("data.csv", delimiter=';').to_numpy() + +tick = data[:, 0] + +rb = data[:, 4] + +""" +nb_files = os.listdir('export/') + +size = len(nb_files) + +# main array +averages = np.empty((size, 2)) +nb = 0 +for i in nb_files: + data = pd.read_csv("export" + os.sep + i, delimiter=';').to_numpy() + rb = data[:, 4] + + total = 0.0 + for x in rb: + total = total + x + average = total / len(rb) + nb_users = i.split(".")[0] + averages[nb, 0] = int(nb_users) + averages[nb, 1] = average + nb += 1 + +# Data for plotting +averages.sort(axis=0) +x = averages[:, 0] +y = averages[:, 1] + +print(averages) +fig, ax = plt.subplots() +ax.scatter(x, y) + +ax.set(xlabel='users', ylabel='ressources (RB)', title='MaxSNR') +ax.grid() + +# fig.savefig("test.png") +plt.show()