From cc73eb8a93899a97fc4580a7f8a3fe66bd533cfe Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 7 Apr 2023 08:12:46 +0200 Subject: [PATCH] maj --- plot/main.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/plot/main.py b/plot/main.py index c70c541..6f38a55 100644 --- a/plot/main.py +++ b/plot/main.py @@ -45,19 +45,18 @@ def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray: nb += 1 return delays -def rb_available_distance(arr: list[tuple[int, np.ndarray]], distance) -> np.ndarray: - available = np.zeros((size, 2)) +def rb_allocate_distance(arr: list[tuple[int, np.ndarray]], distance) -> np.ndarray: + allocate = np.zeros((size, 2)) nb = 0 for nb_users, data in arr: n = 0 for x in data[:,6]: if int(x) == distance: n+=1 - - available[nb, 0] = nb_users - available[nb, 1] = n/ (200 * 10000) * 100 + allocate[nb, 0] = nb_users + allocate[nb, 1] = n#(n/ (200 * 10000)) * 100 nb += 1 - return available + return allocate np_arr: list[tuple[int, np.ndarray]] = list() @@ -67,8 +66,8 @@ for i in nb_files: averages = mean_mkn(np_arr) available = rb_available(np_arr) -available_lp1 = rb_available_distance(np_arr, 200) -available_lp2 = rb_available_distance(np_arr, 400) +allocate_lp1 = rb_allocate_distance(np_arr, 200) +allocate_lp2 = rb_allocate_distance(np_arr, 400) delays = delay(np_arr) delays.sort(axis=0) @@ -88,9 +87,18 @@ ax[1, 0].scatter(delays[:, 0], delays[:, 1]) ax[1, 0].set(xlabel='number of users', ylabel='delays(ms)', title='Delay') ax[1, 0].grid() -#ax[1, 1].scatter(available[:, 0], (available_lp1[:, 1]/available_lp2[:, 1])/available[:, 1] * 100) -ax[1, 1].scatter(available[:, 0], available_lp1[:, 1]) -ax[1, 1].scatter(available[:, 0], available_lp2[:, 1]) +#ax[1, 1].scatter(available[:, 0], (available[:, 1]/available_lp1[:, 1]/available_lp2[:, 1])*100) + +available.sort(axis=0) + +ax[1, 1].scatter(available[:, 0], (allocate_lp1[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100) + +ax[1, 1].plot(available[:, 0], (allocate_lp1[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100) + +ax[1, 1].scatter(available[:, 0], (allocate_lp2[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100) + +ax[1, 1].plot(available[:, 0], (allocate_lp2[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100) + ax[1, 1].set(xlabel='number of users', ylabel='RB utilisés proche/loin/total', title='RB utilisés distance') ax[1, 1].grid()