-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_all
executable file
·38 lines (29 loc) · 1.12 KB
/
plot_all
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from dvbs2adduceremecum.the_baton import ModCod, Conf, user_bits_per_hertz, MOD_ORDERS, LDPC_RATES
import numpy as np
ROLL_OFF = 0.2
conf = Conf(pilots=False, short_frame=False, roll_off=ROLL_OFF)
COLORS = {2: 'red', 3: 'orange', 4: 'blue', 5: 'lightgreen'}
plt.figure(figsize=(10, 10), dpi=80)
for order in MOD_ORDERS:
for rate in LDPC_RATES:
try:
modcod = ModCod(order, rate)
eff = user_bits_per_hertz(modcod, conf)
plt.plot(modcod.esno_min_dB, eff, 'o',
color=COLORS[order],
label='%d - %2d / %2d' % (order, rate.numerator, rate.denominator))
except ValueError as ve:
pass
EsN0s_dB = np.linspace(-3, 17, 100)
plt.plot(EsN0s_dB, np.log2(1 + 10**(EsN0s_dB/10) / (1 + ROLL_OFF)), '--', label="Shannon's Limit", color='black')
plt.axis([-3, 17, 0, 5])
plt.title(conf.__repr__())
plt.xlabel('EsN0 min [dB]')
plt.ylabel('Spectral Efficiency [user bits / Hz]')
plt.grid(True)
plt.legend()
plt.savefig('eff_vs_esno.png', bbox_inches='tight')
plt.show()