comnum.format_moments#

comnum.format_moments(modulation, *, px=None)#

The moments of a modulation format that the EGN model needs: Φ = E|a|⁴/E²|a|² − 2 and Ψ = E|a|⁶/E³|a|² − 9 E|a|⁴/E²|a|² + 12 (Carena et al. 2014), both zero for Gaussian symbols.

Parameters:
  • modulation (Constellation | str) – a constellation, a name such as "16-QAM", or "gaussian".

  • px (array_like, optional) – the probabilities of the points (a shaped source).

Returns:

(Φ, Ψ).

Return type:

tuple[float, float]

Raises:

ValueError – for an input that is not an array of numbers of the expected shape.

Examples

>>> import comnum
>>> [round(v, 4) for v in comnum.format_moments("16-QAM")]
[-0.68, 2.08]