comnum.MemoryPolynomialDpd#

class comnum.MemoryPolynomialDpd(orders=Ellipsis, memory=Ellipsis)#

A memory-polynomial digital predistorter, trained by indirect learning (Eun & Powers 1997; Ding et al. 2004; Morgan et al. 2006).

Parameters:
  • orders (list[int]) – nonlinearity orders (odd: 1, 3, 5, …).

  • memory (int) – memory depth M (samples).

Examples

>>> import comnum, numpy as np
>>> g = 1.0513 + 0.0904j                      # small-signal gain of the amplifier
>>> x = 0.2 * comnum.Rng(1).complex_noise(20_000, 1.0)
>>> dpd = comnum.MemoryPolynomialDpd([1, 3, 5], 3)
>>> dpd.train_indirect(x, comnum.pa_memory_polynomial, gain=g, iterations=2)
>>> nmse = lambda y: float(np.mean(np.abs(y / g - x) ** 2) / np.mean(np.abs(x) ** 2))
>>> nmse(comnum.pa_memory_polynomial(dpd.apply(x))) < nmse(comnum.pa_memory_polynomial(x)) / 5
True

The drive must stay where the amplifier is monotonic: beyond, the post-inverse that indirect learning fits has no meaning and the iterations diverge.

apply(x)#

Predistort a block.

Parameters:

x (array_like) – the input envelope.

Returns:

the predistorted envelope (complex128).

Return type:

numpy.ndarray

Raises:

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

fit(x, y, *, regularization=1e-09)#

Fit the polynomial mapping x to y by regularised least squares.

Parameters:
  • x (array_like) – the input of the polynomial.

  • y (array_like) – the output it should give.

  • regularization (float) – the Tikhonov regularisation.

Raises:

ValueError – for an invalid parameter or input (the message names it).

train_indirect(x, pa, *, gain=Ellipsis, iterations=3, regularization=1e-09)#

Indirect learning against an amplifier.

Parameters:
  • x (array_like) – the training signal.

  • pa (callable) – the amplifier, an array to an array.

  • gain (complex) – the target complex gain of the cascade.

  • iterations (int) – iterations of the indirect learning.

  • regularization (float) – the regularisation of every fit.

Raises:

ValueError – for an invalid parameter or input (the message names it).

coefficients#

The coefficients, order after order, tap after tap (complex128).

Type:

numpy.ndarray