theory#

Functions for calculating theoretical properties

Functions for calculating analytic properties of communication signals.

qampy.theory.ber_vs_es_over_n0_qam(snr, M)#

Bit-error-rate vs signal to noise ratio after formula in _[1].

Parameters:
  • snr (array_like) – Signal to noise ratio in linear units

  • M (integer) – Order of M-QAM

Returns:

ber – theoretical bit-error-rate

Return type:

array_like

References

…[3] Shafik, R. (2006). On the extended relationships among EVM, BER and SNR as performance metrics. In Conference on Electrical and Computer Engineering (p. 408). Retrieved from http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4178493

qampy.theory.ber_vs_evm_qam(evm_dB, M)#

Calculate the bit-error-rate for a M-QAM signal as a function of EVM. Taken from _[1]. Note that here we miss the square in the definition to match the plots given in the paper.

Parameters:
  • evm_dB (array_like) – Error-Vector Magnitude in dB

  • M (integer) – order of M-QAM

Returns:

ber – bit error rate in linear units

Return type:

array_like

References

…[1] Shafik, R. (2006). On the extended relationships among EVM, BER and SNR as performance metrics. In Conference on Electrical and Computer Engineering (p. 408). Retrieved from http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4178493

Note

The EVM in dB is defined as $EVM(dB) = 10 log_{10}{P_{error}/P_{reference}}$ (see e.g. Wikipedia) this is different to the percentage EVM which is defined as the RMS value i.e. $EVM(%)=sqrt{1/N sum^N_{j=1} [(I_j-I_{j,0})^2 + (Q_j -Q_{j,0})^2]} $ so there is a difference of a power 2. So to get the same plot as in _[1] we need to enter the log of EVM^2

qampy.theory.cal_gmi(M, snr, N=1000)#

Calculate the soft-decision GMI for a given modulation format based on a Monte-Carlo method. Assumes a gray-coded square QAM format.

Parameters:
  • M (int) – QAM order

  • snr (float or array_like) – Signal-to-noise-ratio in dB where to calculate the gmi

  • N (int, optional) – Number of noise realisations for the Monte-Carlo simulation

Return type:

GMI

qampy.theory.cal_ps_probablts(symbols, nu)#

Calculate probabilities for probabilistic constellation shaping of symbols

Parameters:
  • symbols (array_like) – coded input symbols

  • nu (float) – shaping factor

Returns:

  • symbs (array_like) – real part of the coded symbols

  • px (array_like) – corresponding probabilities

qampy.theory.cal_scaling_factor_qam(M)#

Calculate the scaling factor for normalising MQAM symbols to 1 average Power

qampy.theory.cal_symbols_cross_qam(M)#

Generate the symbols on the constellation diagram for non-square (cross) M-QAM

qampy.theory.cal_symbols_psk(M)#

Generate M-PSK symbols

Parameters:

M (int) – PSK order

Returns:

symbols – PSK symbols normalised to power of 1

Return type:

array_like

qampy.theory.cal_symbols_qam(M)#

Generate the symbols on the constellation diagram for M-QAM

qampy.theory.cal_symbols_square_qam(M)#

Generate the symbols on the constellation diagram for square M-QAM

qampy.theory.generate_ps_symbols(N, symbs, px, normalize=True)#

Generate a set of probabilistically shaped symbols

Parameters:
  • N (int) – length of the symbol array

  • symbs (array_like) – the real part of the symbols to pick

  • px (array_like) – the corresponding probabilities

  • normalize (bool,optional) – whether to normalise the output

Returns:

mod_symbols – set of probabilistically shaped symbols

Return type:

array_like

qampy.theory.gray_code_qam(M)#

Generate gray code map for M-QAM constellations

qampy.theory.hybrid_qam_ber_vs_esn0(snr, pr, fr, M1, M2)#

Calculate bit error rate as function of SNR for time-domain hybrid QAM (according to _[1]).

Parameters:
  • snr (float) – signal ot noise ratio in dB

  • pr (float) – ratio of average signal power modulated with first QAM order over avg power of second QAM order

  • fr (float) – format ratio, fraction of symbols with modulation M2 of the overall frame.

  • M1 (integer) – First QAM format

  • M2 (integer) – Second QAM format

Returns:

ber – theoretical bit error rate for the given TD hybrid QAM

Return type:

float

References

..[1] Curri et al. “Time-division hybrid modulation formats: Tx operation strategies and countermeasures to

nonlinear propagation”, OFC 2014

qampy.theory.ser_vs_es_over_n0_4pam(snr)#

Calculate the symbol error rate (SER) of an 4-PAM signal as a function of Es/N0 (Symbol energy over noise energy, given in linear units

qampy.theory.ser_vs_es_over_n0_psk(snr, M)#

Calculate the symbol error rate (SER) of an M-PSK signal as a function of Es/N0 (Symbol energy over noise energy, given in linear units

qampy.theory.ser_vs_es_over_n0_qam(snr, M)#

Calculate the symbol error rate (SER) of an M-QAM signal as a function of Es/N0 (Symbol energy over noise energy, given in linear units. Works only correctly for M > 4

qampy.theory.sim_mi_mc(symbols, snr, N)#

Perform Monte-Carlo simulations of AWGN Mutual Information.

Parameters:
  • symbols (array_like) – symbol alphabet to calculate the MI for

  • snr (float) – The signal to noise ratio that should be simulated (in dB)

  • N (int) – The size of the noise array to average over

Returns:

mi – Mutual information of the symbol alphabet at the given SNR

Return type:

float