使用 Python 在 GNU Radio 中计算 BER 置信度

BER confidence level calculation in GNU Radio using Python

正在为 GNU Radio OOT 开发基于 python 的 BER 置信度计算器。根据参考文献 1,置信度由以下公式计算

然而,参考文献2使用以下公式计算置信度:

第一个问题是关于两个公式的。他们为什么不同?我确实尝试实施它们。第一个版本非常简单。但是,第二个公式中的指数和阶乘运算导致了“OverflowError:数学范围错误”问题。我们如何处理?

import math
def confidence_level(N,ber,E):
    sum = 0.0;
    for k in range(0,E):
        sum += math.pow(N*ber,k)/math.factorial(k);
    cl = 1.0 - math.exp(-N*ber)*sum;
    print cl;

confidence_level(1.80e+10, 1.0e-6, 6350);

参考文献 1:https://www.keysight.com/main/editorial.jspx?ckey=1481106&id=1481106&nid=-11143.0.00&lc=eng&cc=LV

参考文献 2:https://www.jitterlabs.com/support/calculators/ber-confidence-level-calculator

编辑 似乎第一个公式减少为 CL = 1 - exp(-NErrors),因为 BER = NErrors/NBits。对于Eb/No = 7 dB的BPSK调制,在检测到14个错误后得到100%的置信水平,这似乎并不准确。

NBits: 1600 NErrs: 1 BER: 6.2500E-04 CL: 6.3212E-01

NBits: 3200 NErrs: 1 BER: 3.1250E-04 CL: 6.3212E-01

NBits:4800 NErrs:3 BER:6.2500E-04 CL:9.5021E-01

NBits:8000 NErrs:6 BER:7.5000E-04 CL:9.9752E-01

NBits:9600 NErrs:6 BER:6.2500E-04 CL:9.9752E-01

NBits:11200 NErrs:8 BER:7.1429E-04 CL:9.9966E-01

NBits:12800 NErrs:8 BER:6.2500E-04 CL:9.9966E-01

NBits:14400 NErrs:9 BER:6.2500E-04 CL:9.9988E-01

NBits:16000 NErrs:9 BER:5.6250E-04 CL:9.9988E-01

NBits:17600 NErrs:10 BER:5.6818E-04 CL:9.9995E-01

NBits:19200 NErrs:12 BER:6.2500E-04 CL:9.9999E-01

NBits:20800 NErrs:12 BER:5.7692E-04 CL:9.9999E-01

NBits:22400 NErrs:12 BER:5.3571E-04 CL:9.9999E-01

NBits:24000 NErrs:14 BER:5.8333E-04 CL:1.0000E+00

NBits:25600 NErrs:16 BER:6.2500E-04 CL:1.0000E+00

NBits:27200 NErrs:18 BER:6.6176E-04 CL:1.0000E+00

NBits:28800 NErrs:18 BER:6.2500E-04 CL:1.0000E+00

Why are the formulas different?

公式 1 只有在错误为零(即 E=0)时才能使用。在那种情况下,它相当于公式2.

无论您观察到多少错误,都可以使用公式 2 计算置信度。

How do we deal with the overflow?

第二个方程中的 e^(-N*BER_s) * sum(...) 项是 poisson cumulative distribution function with parameters lambda = N*BER_s and k = E. Conveniently, this function is implemented in the scipy.stats 模块。因此,我们可以按如下方式计算置信度:

from scipy.stats import poisson
def confidence_level(N, BER_s, E):
    return 1 - poisson.cdf(E, N*BER_s)

对于你的值(N=1.80e+10,BER_s=1.0e-6,E=6350),这个函数returns 1.0。因此,您可以 100% 确信测试的真实 BER 小于 1.0e-6。