Skip to content

komm.ASKModulation

Amplitude-shift keying (ASK) modulation. It is a complex modulation scheme in which the points of the constellation symbols are uniformly arranged in a ray. More precisely, the $i$-th constellation symbol is given by $$ x_i = iA \exp(\mathrm{j}\phi), \quad i \in [0 : M), $$ where $M$ is the order (a power of $2$), $A$ is the base amplitude, and $\phi$ is the phase offset of the modulation.

Parameters:

  • order (int)

    The order $M$ of the modulation. It must be a power of $2$.

  • base_amplitude (float)

    The base amplitude $A$ of the constellation. The default value is 1.0.

  • phase_offset (float)

    The phase offset $\phi$ of the constellation. The default value is 0.0.

  • labeling (Literal['natural', 'reflected'] | ArrayLike)

    The binary labeling of the modulation. Can be specified either as a 2D-array of integers (see base class for details), or as a string. In the latter case, the string must be either 'natural' or 'reflected'. The default value is 'reflected', corresponding to the Gray labeling.

Examples:

  1. The $4$-ASK modulation with base amplitude $A = 1$, phase offset $\phi = 0$, and Gray labeling is depicted below.

    4-ASK modulation with Gray labeling.

    >>> ask = komm.ASKModulation(4)
    >>> ask.constellation
    array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
    >>> ask.labeling
    array([[0, 0],
           [0, 1],
           [1, 1],
           [1, 0]])
    
  2. The $4$-ASK modulation with base amplitude $A = 2\sqrt{2}$, phase offset $\phi = \pi/4$, and natural labeling is depicted below.

    4-ASK modulation with natural labeling.

    >>> ask = komm.ASKModulation(
    ...     order=4,
    ...     base_amplitude=2*np.sqrt(2),
    ...     phase_offset=np.pi/4,
    ...     labeling='natural',
    ... )
    >>> ask.constellation
    array([0.+0.j, 2.+2.j, 4.+4.j, 6.+6.j])
    >>> ask.labeling
    array([[0, 0],
           [0, 1],
           [1, 0],
           [1, 1]])
    

constellation NDArray[complexfloating] cached property

The constellation $\mathbf{X}$ of the modulation.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.constellation
array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])

labeling NDArray[integer] cached property

The labeling $\mathbf{Q}$ of the modulation.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.labeling
array([[0, 0],
       [0, 1],
       [1, 1],
       [1, 0]])

inverse_labeling dict[tuple[int, ...], int] cached property

The inverse labeling of the modulation. It is a dictionary that maps each binary tuple to the corresponding constellation index.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.inverse_labeling
{(0, 0): 0, (0, 1): 1, (1, 1): 2, (1, 0): 3}

order int cached property

The order $M$ of the modulation.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.order
4

bits_per_symbol int cached property

The number $m$ of bits per symbol of the modulation. It is given by $$ m = \log_2 M, $$ where $M$ is the order of the modulation.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.bits_per_symbol
2

energy_per_symbol float cached property

The average symbol energy $E_\mathrm{s}$ of the constellation. It assumes equiprobable symbols. It is given by $$ E_\mathrm{s} = \frac{1}{M} \sum_{i \in [0:M)} \lVert x_i \rVert^2, $$ where $\lVert x_i \rVert^2$ is the energy of constellation symbol $x_i$, and $M$ is the order of the modulation.

For the ASK, it is given by $$ E_\mathrm{s} = \frac{A^2}{6} (M - 1) (2M - 1). $$

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.energy_per_symbol
3.5

energy_per_bit float cached property

The average bit energy $E_\mathrm{b}$ of the constellation. It assumes equiprobable symbols. It is given by $$ E_\mathrm{b} = \frac{E_\mathrm{s}}{m}, $$ where $E_\mathrm{s}$ is the average symbol energy, and $m$ is the number of bits per symbol of the modulation.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.energy_per_bit
1.75

symbol_mean complex cached property

The mean $\mu_\mathrm{s}$ of the constellation. It assumes equiprobable symbols. It is given by $$ \mu_\mathrm{s} = \frac{1}{M} \sum_{i \in [0:M)} x_i. $$

For the ASK, it is given by $$ \mu_\mathrm{s} = \frac{A}{2} (M-1) \exp(\mathrm{j}\phi). $$

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.symbol_mean
(1.5+0j)

minimum_distance float cached property

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 x_i - x_j \rVert. $$

For the ASK, it is given by $$ d_\mathrm{min} = A. $$

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.minimum_distance
1.0

modulate()

Modulates one or more sequences of bits to their corresponding constellation symbols.

Parameters:

  • input (ArrayLike)

    The input sequence(s). Can be either a single sequence whose length is a multiple of $m$, or a multidimensional array where the last dimension is a multiple of $m$.

Returns:

  • output (NDArray[complexfloating])

    The output sequence(s). Has the same shape as the input, with the last dimension divided by $m$.

Examples:

>>> ask = komm.ASKModulation(4)
>>> ask.modulate([0, 0, 1, 1, 0, 0, 0, 1])
array([0.+0.j, 2.+0.j, 0.+0.j, 1.+0.j])

demodulate_hard()

Demodulates one or more sequences of received points to their corresponding sequences of hard bits ($\mathtt{0}$ or $\mathtt{1}$) using hard-decision decoding.

Parameters:

  • input (ArrayLike)

    The input sequence(s). Can be either a single sequence, or a multidimensional array.

Returns:

  • output (NDArray[integer])

    The output sequence(s). Has the same shape as the input, with the last dimension multiplied by $m$.

demodulate_soft()

Demodulates one or more sequences of received points to their corresponding sequences of soft bits (L-values) using soft-decision decoding. The soft bits are the log-likelihood ratios of the bits, where positive values correspond to bit $\mathtt{0}$ and negative values correspond to bit $\mathtt{1}$.

Parameters:

  • input (ArrayLike)

    The received sequence(s). Can be either a single sequence, or a multidimensional array.

  • snr (float)

    The signal-to-noise ratio (SNR) of the channel. It should be a positive real number. The default value is 1.0.

Returns:

  • output (NDArray[floating])

    The output sequence(s). Has the same shape as the input, with the last dimension multiplied by $m$.