-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot4.py
71 lines (51 loc) · 2.08 KB
/
plot4.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
"""
Compare the sum rate between the neural network and the Zero-forcing
Author : Khin Thandar Kyaw
Date : 21 OCT 2023
Last Modified : 15 Nov 2023
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from nn_utils import *
# tf_version: 2.15.0
print(tf.__version__)
print("Loading...")
# --------------------------- Start --------------------------------
total_users = ''.join(map(str, total_users()))
Nt, N, _, _, _, _, _ = parameters(6) # 6 is just a placeholder
snr_fixed = fixed_snr()
global_ymin = 0
global_ymax = 60
# load the data
rate_NN_unsuper_case_1 = np.load(f'Plotting/{total_users}users/sumRateSupercase1.npy')
rate_NN_unsuper_case_2 = np.load(f'Plotting/{total_users}users/sumRateSupercase2.npy')
rateWFcase1 = np.load(f'Plotting/{total_users}users/sumRateWFcase1.npy')
rateWFcase2 = np.load(f'Plotting/{total_users}users/sumRateWFcase2.npy')
print('Loading...')
print_line()
plt.rcParams['text.usetex'] = True
plt.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}'
plt.figure(figsize=(7, 6))
# Plot lines
#plottingLine(rateZF60, 'ZF-SBF [N = 60]', 'dotted', 'green', '+')
plot_line(rateWFcase1, r'ZF beam w/ WF pwr [Rank ($R_h$) = 1 for all UEs]', 'dashed', 'blue', 'v')
plot_line(rateWFcase2, r'ZF beam w/ WF pwr [Rank ($R_h$) = 2 for all UEs]', 'dashed', 'red', 'P')
plot_line(rate_NN_unsuper_case_1, r'Proposed [Rank ($R_h$) = 1 for all UEs]', 'solid', 'blue', 'v')
plot_line(rate_NN_unsuper_case_2, r'Proposed [Rank ($R_h$) = 2 for all UEs]', 'solid', 'red', 'P')
# Legend
plt.legend(loc='upper left', ncol=1, fontsize=15)
plt.ylim([global_ymin, global_ymax])
# Axes labels
plt.rc('text', usetex=True)
plt.xlabel(r'$P_{\mathrm{T}}/\sigma_n^2$ (dB)', fontsize=16)
plt.ylabel('Approximate sum rate (bps/Hz)', fontsize=16)
# Title
plt.title(r'$N_t$ = {}, $N$ = {}, $M + K$ = {}'.format(Nt, N, total_users), fontsize=16)
plt.grid(True)
plt.tight_layout() # Adjust layout to prevent clipping of legend
#plt.savefig(f'Plotting/fig4.tiff')
plt.savefig(f'Plotting/fig4.png')
plt.savefig('Plotting/fig4.eps', format='eps')
plt.close()
print("Done!")