komm.QAMConstellation
Quadrature amplitude modulation (QAM) constellation. It is a complex one-dimensional constellation obtained by a Cartesian product of two PAM constellations, namely, the in-phase constellation, and the quadrature constellation. For more details, see SA15, Sec. 2.5.1.
Parameters:
-
orders
(tuple[int, int] | int
) –A tuple $(M_\mathrm{I}, M_\mathrm{Q})$ with the orders of the in-phase and quadrature constellations, respectively. If specified as a single integer $M$, then it is assumed that $M_\mathrm{I} = M_\mathrm{Q} = \sqrt{M}$; in this case, $M$ must be a perfect square.
-
deltas
(tuple[float, float] | float
) –A tuple $(\Delta_\mathrm{I}, \Delta_\mathrm{Q})$ with the distances of the in-phase and quadrature constellations, respectively. If specified as a single float $\Delta$, then it is assumed that $\Delta_\mathrm{I} = \Delta_\mathrm{Q} = \Delta$. The default value is
2.0
. -
phase_offset
(float
) –The phase offset $\phi$ of the constellation (in turns, not radians). The default value is
0.0
.
Examples:
-
The square $16$-QAM constellation with $(M_\mathrm{I}, M_\mathrm{Q}) = (4, 4)$ and $(\Delta_\mathrm{I}, \Delta_\mathrm{Q}) = (2, 2)$ is depicted below.
>>> const = komm.QAMConstellation(16)
-
The rectangular $8$-QAM constellation with $(M_\mathrm{I}, M_\mathrm{Q}) = (4, 2)$ and $(\Delta_\mathrm{I}, \Delta_\mathrm{Q}) = (2, 4)$ is depicted below.
>>> const = komm.QAMConstellation(orders=(4, 2), deltas=(2.0, 4.0))
matrix
Array2D[complexfloating]
cached
property
The constellation matrix $\mathbf{X}$.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.matrix
array([[-3.-3.j],
[-3.-1.j],
[-3.+1.j],
[-3.+3.j],
[-1.-3.j],
[-1.-1.j],
[-1.+1.j],
[-1.+3.j],
[ 1.-3.j],
[ 1.-1.j],
[ 1.+1.j],
[ 1.+3.j],
[ 3.-3.j],
[ 3.-1.j],
[ 3.+1.j],
[ 3.+3.j]])
order
int
property
The order $M$ of the constellation.
For the QAM constellation, it is given by $$ M = M_\mathrm{I} M_\mathrm{Q}. $$
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.order
16
dimension
int
property
The dimension $N$ of the constellation.
For the QAM constellation, it is given by $N = 1$.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.dimension
1
mean()
Computes the mean $\mathbf{m}$ of the constellation given prior probabilities $p_i$ of the constellation symbols. It is given by $$ \mathbf{m} = \sum_{i \in [0:M)} p_i \mathbf{x}_i. $$
Parameters:
-
priors
(ArrayLike | None
) –The prior probabilities of the constellation symbols. Must be a 1D-array whose size is equal to the order $M$ of the constellation. If not given, uniform priors are assumed.
Returns:
-
mean
(Array1D[complexfloating]
) –The mean $\mathbf{m}$ of the constellation.
For uniform priors, the mean of the QAM constellation is given by $$ \mathbf{m} = 0. $$
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.mean()
array([0.+0.j])
mean_energy()
Computes the mean energy $E$ of the constellation given prior probabilities $p_i$ of the constellation symbols. It is given by $$ E = \sum_{i \in [0:M)} p_i \lVert \mathbf{x}_i \rVert^2. $$
Parameters:
-
priors
(ArrayLike | None
) –The prior probabilities of the constellation symbols. Must be a 1D-array whose size is equal to the order $M$ of the constellation. If not given, uniform priors are assumed.
Returns:
-
mean_energy
(floating
) –The mean energy $E$ of the constellation.
For uniform priors, the mean energy of the QAM constellation is given by $$ E = \frac{\Delta_\mathrm{I}^2}{12}(M_\mathrm{I}^2 - 1) + \frac{\Delta_\mathrm{Q}^2}{12}(M_\mathrm{Q}^2 - 1). $$ For the special case of a square QAM constellation, this simplifies to $$ E = \frac{\Delta^2}{6}(M - 1). $$
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.mean_energy()
np.float64(10.0)
minimum_distance()
Computes the minimum Euclidean distance $d_\mathrm{min}$ of the constellation. It is given by $$ d_\mathrm{min} = \min_ { i, j \in [0:M), ~ i \neq j } \lVert \mathrm{x}_i - \mathrm{x}_j \rVert. $$
For the QAM constellation, the minimum distance is given by $$ d_{\min} = \min(\Delta_\mathrm{I}, \Delta_\mathrm{Q}). $$
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.minimum_distance()
np.float64(2.0)
indices_to_symbols()
Returns the constellation symbols corresponding to the given indices.
Parameters:
-
indices
(ArrayLike
) –The indices to be converted to symbols. Must be an array of integers in $[0:M)$.
Returns:
-
symbols
(NDArray[complexfloating]
) –The symbols corresponding to the given indices. Has the same shape as
indices
, but with the last dimension expanded by a factor of $N$.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.indices_to_symbols([3, 0])
array([-3.+3.j, -3.-3.j])
>>> const.indices_to_symbols([[3, 0], [1, 2]])
array([[-3.+3.j, -3.-3.j],
[-3.-1.j, -3.+1.j]])
closest_indices()
Returns the indices of the constellation symbols closest to the given received points.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
Returns:
-
indices
(NDArray[integer]
) –The indices of the symbols closest to the received points. Has the same shape as
received
, but with the last dimension contracted by a factor of $N$.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.closest_indices([-3.1 + 2.9j, -3 - 3.5j])
array([3, 0])
closest_symbols()
Returns the constellation symbols closest to the given received points.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
Returns:
-
symbols
(NDArray[complexfloating]
) –The symbols closest to the received points. Has the same shape as
received
.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.closest_symbols([-3.1 + 2.9j, -3 - 3.5j])
array([-3.+3.j, -3.-3.j])
posteriors()
Returns the posterior probabilities of each constellation symbol given received points, the signal-to-noise ratio (SNR), and prior probabilities.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
-
snr
(float
) –The signal-to-noise ratio (SNR) of the channel (linear, not decibel).
-
priors
(ArrayLike | None
) –The prior probabilities of the symbols. Must be a 1D-array whose size is equal to $M$. If not given, uniform priors are assumed.
Returns:
-
posteriors
(NDArray[floating]
) –The posterior probabilities of each symbol given the received points. Has the same shape as
received
, but with the last dimension changed by a factor of $M / N$.
Examples:
>>> const = komm.QAMConstellation(16)
>>> const.posteriors([-3.1 + 2.9j], snr=2.0).round(3)
array([0. , 0.021, 0.219, 0.449, 0. , 0.009, 0.091, 0.186, 0. ,
0.001, 0.008, 0.016, 0. , 0. , 0. , 0. ])