comnum.classify_modulation#
- comnum.classify_modulation(x, candidates, method='ml', *, noise_var=None)#
Blind modulation classification at one sample per symbol, timing and carrier recovered.
Methods:
"ml"(the likelihood, the scale and the noise estimated by M2M4 under every candidate),"ml_known"(the likelihood with the noise variancenoise_varknown and the symbols of unit energy, Wei & Mendel 2000),"cumulants"(the nearest fourth-order features|C40|/C21²,C42/C21², Swami & Sadler 2000; withnoise_var, normalised byC21 - noise_var).- Parameters:
x (array_like) – the samples (complex).
candidates (list[Constellation]) – the candidate alphabets (scaled to unit energy).
method (str) – the classifier.
noise_var (float, optional) – the noise variance, for
"ml_known"and"cumulants".
- Returns:
index(the decided candidate) andscores(one per candidate, the largest wins).- Return type:
- Raises:
ValueError – for an invalid parameter or input (the message names it).
Examples
>>> import comnum, numpy as np >>> rng = comnum.Rng(1) >>> cands = [comnum.Constellation(k, m).normalized() for k, m in [("psk", 2), ("qam", 4), ("qam", 16)]] >>> x = cands[2].points[rng.integers(16, 2000)] + rng.complex_noise(2000, 0.02) >>> comnum.classify_modulation(x, cands)["index"] 2