Modulation

This module implements the modulation and demodulation functionality based on 3GPP TS 38.211. The Modem class handles modulation and demodulation of bitstreams to and from complex symbols.

class neoradium.modulation.Modem(modulation='QPSK')

This class handles the process of modulating a bitstream to an array of complex symbols (Modulation) as well as extracting log-likelihood ratios (LLRs) from an array of complex symbols during demodulation. This implementation is based on 3GPP TS 38.211 section 5.1.

Parameters:

modulation (str) –

The modulation scheme based on Section 5.1 in 3GPP TS 38.211. The supported modulation schemes are:

Modulation Scheme

Modulation Order (qm)

BPSK

1

QPSK

2

16QAM

4

64QAM

6

256QAM

8

1024QAM

10

Other Properties:

In addition to the modulation parameter, here is a list of additional properties for this class.

qm:

The modulation order. This is the number of bits per modulated symbol. See 3GPP TS 38.211, Table 7.3.1.2-1 for more details.

constellation:

The modulation constellation. This is a lookup table that converts each group of qm bits from the input bitstream to a complex symbol.

print(indent=0, title=None, getStr=False)

Prints the properties of this Modem object.

Parameters:
  • indent (int) – The number of indentation characters.

  • title (str or None) – If specified, it is used as the title for the printed information. If None (the default), the text “Modem Properties:” is used for the title.

  • getStr (bool) – If True, returns a string instead of printing it.

Returns:

If the getStr parameter is True, then this function returns the information in a string. Otherwise, nothing is returned.

Return type:

None or str

modulate(bitstreams)

Modulates the given bitstream into one or more arrays of complex symbols using the current modulation scheme.

Parameters:

bitstreams (NumPy array of bits) – A 1-D (one code block) or 2-D (several code blocks) array of bits.

Returns:

Returns a 1-D or 2-D (depending on shape of bitstreams) NumPy complex array of modulated symbols.

Return type:

NumPy array of complex values

getLLRs(symbols, noiseVar, useMax=True)

This function calculates the log-likelihood ratios (LLRs) for each bit from the received noisy symbols. The LLR values can then be used by PolarDecoder or LdpcDecoder to extract the decoded bitstream.

Parameters:
  • symbols (1-D or 2-D Complex NumPy array) – An m``x``n complex NumPy array where m is the number of coded blocks and n is the length of each code block. If it is a 1-D array, it means there is only one code block to demodulate.

  • noiseVar (float) – The noise variance obtained using noise estimation or using the actual noise variance value used in simulation.

  • useMax (bool) – If True (the default), this implementation uses the Max function in the calculation of the LLR values. This is faster but uses an approximation and is slightly less accurate than the actual Log Likelihood method which uses logarithm and exponential functions. If False, the slower more accurate method is used.

Returns:

A 1-D or 2-D NumPy array of LLR values depending on the dimensionality of symbols. In the case of a 2-D array, the return value is an m``x``l array of LLR values where l= n * qm. In case of 1-D array, the output is a 1-D array of l LLR values.

Return type:

NumPy array of floating-point values

getLLRsFromSymbols(symbols, noiseVar, useMax=True)

DEPRECATED: This method is deprecated and will be removed in future releases. Please use the getLLRs() method instead.

demodulate(symbols, noiseVar, useMax=True)

Demodulates the received noisy symbols to a bitstream using hard decisions to convert log-likelihood ratios (LLRs) to bits. This function first calls the Modem.getLLRs() method to get the LLR values, and then uses “hard decision” to convert LLRs to bits.

Parameters:
  • symbols (1-D or 2-D Complex NumPy array) – An m x n complex NumPy array where m is the number of coded blocks and n is the length of each code block. If it is a 1-D array, it means there is only one code block to demodulate.

  • noiseVar (float) – The noise variance obtained using noise estimation or using the actual noise variance value used in simulation.

  • useMax (bool) – If True, this implementation uses the Max function in the calculation of the LLR values. This is faster but uses an approximation and is slightly less accurate than the actual Log Likelihood method which uses logarithm and exponential functions. If False, the slower more accurate method is used.

Returns:

Returns a 1-D or 2-D NumPy array of demodulated bits, depending on the dimensionality of symbols.

Return type:

NumPy array of bit values