Constellations

class Constellations.BaseConstellation[source]

Base class for constellations such as QAM or PSK.

Notes

  • Other constellations should be derived from this class. They need to initialize self._alphabet, which is returned by the alphabet property, self._bit_matrix, which is returned by the bit_matrix property, and self._str, which is returned by the str property.
  • Bits are represented by the numbers zero and one.
alphabet

Vector of constellation points. The number of points has to be a power of two.

Type:numpy.array (complex)
bit_matrix

Matrix of bit patterns.

The size of the matrix should be N x M, where N is the size of the alphabet and M is the number of bits per symbol. The n-th row of the matrix contains the bit pattern of the n-th symbol in the alphabet. The allowed values in the matrix are zero and one.

Type:numpy.array(int)
gray_code(m, n)[source]

Gray code bit matrix.

Parameters:
Returns:

Matrix as described in the bit_matrix property. The number of bit patterns (rows) is m*n. The number of bits per pattern (columns) is ceil(log2(m*n)).

Return type:

numpy.array(int)

idx2bits(idx)[source]

Translates a vector of indices into a bit pattern.

Parameters:idx (numpy.array(complex)) – Vector of indices
Returns:Vector of bits
Return type:numpy.array(complex)
idx2symbol(idx)[source]

Translates a vector of indices into a vector of symbols.

Parameters:idx (numpy.array(integer)) – Vector of indices.
Returns:A array with the same length as idx whose n-th element is self.alphabet[idx[n]].
Return type:numpy.array(complex)
name

Identifcation string for the constellation, should also specify parameters.

Type:str
show(new_fig=False)[source]

Shows the constellation alphabet together with the bit patterns.

Parameters:new_fig (bool) – Always creates a new figure if True, reuses existing figures if False.
Returns:matplotlib figure handle (only if new_fig=True)
Return type:Figure
size()[source]

int : Number of elements in the alphabet.

symbol2idx(symbols)[source]

Translates a vector of symbols into a vector of indices.

Parameters:symbols (numpy.array(complex)) – Vector of symbols.
Returns:A vector with the same length as symbols whose n-th element is the integer number i=i(n) in 0,…,numpy.size(symbols)-1 that minimizes the Eucledian distance |symbols[n] - self.alphabet[i]|.
Return type:numpy.array(integer)
class Constellations.MPSKConstellation(m, rotate_by_delta_half=False)[source]

Phase shift keying (PSK) modulation. Implements BaseConstellation.

__init__(m, rotate_by_delta_half=False)[source]

Contructor for a PSK constellation.

Parameters:
  • m (int) – Number of constellation points
  • rotate_by_delta_half (Boolean) – Rotate constellation by 2pi/m
class Constellations.QAMConstellation(m, n)[source]

Quadrature amplitude modulation (QAM) constellation (implements BaseConstellation).

__init__(m, n)[source]

Constructor for a m x n QAM constellation.

Parameters:
  • m (int) – Number of rows in the constellation.
  • n (int) – Number of columns in the constellation.
class Constellations.ReshapedQAMConstellation(m, n, b0_fun, Ed, bnds)[source]

Reshaped quadrature amplitude modulation (QAM) constellation (implements BaseConstellation).

The goal of the reshaping procedure is to fit the average (normalized) energy of the generated pulses to a desired value Ed. For details, see Gui et al., Opt. Express 26(21), 2018.

__init__(m, n, b0_fun, Ed, bnds)[source]

Constructor for a reshaped m x n QAM constellation.

Parameters:
  • m (int) –
  • n (int) –
  • b0_fun (function) – Carrier waveform. The function should maps any input vector of the type numpy.array(float), which represents a vector of nonlinear frequencies xi, to a output vector of the type numpy.array(complex), which represents the values of the carrier waveform at these xi.
  • Ed (float) – Desired average energy of the generated pulses (with respect to normalized units). Should be positive.
  • bnds (numpy.array(float)) – Vector with two entries [a,b], which are used as initial bounds in the bisection produdure based on which the constellation is reshaped. It should be 0<a<b.