This repository has been archived on 2023-08-28. You can view files and clone it, but cannot push or open issues or pull requests.
ntr-interferences/plot/main.py

44 lines
913 B
Python
Raw Normal View History

2023-03-24 10:37:35 +01:00
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
nb_files = os.listdir(".." + os.sep + "export")
2023-03-24 10:37:35 +01:00
size = len(nb_files)
2023-03-24 11:12:40 +01:00
def mean_mkn() -> np.ndarray:
averages_mkn = np.empty((size, 2))
nb = 0
for i in nb_files:
data = pd.read_csv(".." + os.sep + "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_mkn[nb, 0] = int(nb_users)
averages_mkn[nb, 1] = average
nb += 1
return averages_mkn
averages = mean_mkn()
2023-03-24 10:37:35 +01:00
# 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()