-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_low_rank_2.py
More file actions
56 lines (43 loc) · 1.65 KB
/
plot_low_rank_2.py
File metadata and controls
56 lines (43 loc) · 1.65 KB
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
import matplotlib.pyplot as plt
import matplotlib as mpl
import plot_tools as p_t
R1 = 1
M = 2000
NB = 131072
R2 = 0.005
# fig, ax = plt.subplots(figsize=(5.4,4))
plt.figure(figsize=(5.4,3.5))
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.size'] = 14
folder_RIE = 'data/RIE'
folder_MMSE = 'data/MMSE'
colors = plt.rcParams['axes.prop_cycle'].by_key()['color']
delta_list, MSE = p_t.low_rank(delta_min_exp=-3, delta_max_exp=2, R1=R1)
plt.plot(delta_list, MSE, color='black', label='Low Rank')
# plt.axvline(x=np.sqrt(R1),ymax=1,ymin=0,alpha=.3,color='black')
def condition_RIE(file, M,R1,R2):
return p_t.find_R1(file) == R1 and p_t.find_R2(file)>1e-2 and p_t.find_M(file) == M
def condition_MMSE(file, NB,R1,R2):
return p_t.find_R1(file) == R1 and p_t.find_R2(file)>1e-2 and p_t.find_NB(file) >= NB
def x_func(x, file):
return x * p_t.find_R2(file)
def label_func(file):
return f'$R_2 = {p_t.find_R2(file)}$'
color_idx = 0
filenames = p_t.file_select(folder_RIE, p_t.find_R2)
for i, file in enumerate(filenames):
color_idx = p_t.plot_data_RIE(M, R1, R2, folder_RIE, file, colors, color_idx, plt, condition_RIE, x_func= lambda l: x_func(l,file))
color_idx = 0
filenames = p_t.file_select(folder_MMSE, p_t.find_R2)
for i, file in enumerate(filenames):
color_idx = p_t.plot_data_MMSE(M, R1, R2, folder_MMSE, file, colors, color_idx, plt, condition_MMSE, x_func= lambda l: x_func(l,file), label_func=label_func)
plt.legend(frameon=False, loc='upper left')
plt.title(f'$R_1 = {R1}$')
plt.xscale('log')
plt.ylabel('Y-MSE')
plt.xlabel('$\Delta R_2$')
plt.ylim((-.05,1.05))
plt.xlim((1e-3,1e2))
plt.tight_layout()
plt.savefig('low_rank_2.pdf')
plt.show()