- class sdr.ErrorRate
A class for measuring bit error rates (BER) or symbol error rates (SER).
See also
Examples¶
Create a new bit error rate measurement object.
In [1]: ber = sdr.ErrorRate() In [2]: x = [1, 1, 1, 1, 1] # Reference bit vector
Measure and accumulate bit errors from the first received bit vector containing 1 bit error at 10 dB SNR. The bit error rate of the first received bit vector is 0.2.
In [3]: x_hat = [1, 0, 1, 1, 1]; \ ...: ber.add(10, x, x_hat) ...: Out[3]: (1, 5, 0.2)
Measure and accumulate bit errors from the second received bit vector containing 2 bit errors at 10 dB SNR. The bit error rate of the second received bit vector is 0.4.
In [4]: x_hat = [1, 0, 1, 0, 1]; \ ...: ber.add(10, x, x_hat) ...: Out[4]: (2, 5, 0.4)
The total errors are 3, total bits 10, and average bit error rate 0.3.
In [5]: ber.errors(10), ber.counts(10), ber.error_rate(10) Out[5]: (3, 10, 0.3)
Average bit error rates for every SNR can be obtained as follows.
In [6]: ber.error_rates() Out[6]: (array([10]), array([0.3]))
Constructors¶
- ErrorRate()
Creates a new error rate tabulation object.
Methods¶
- add(snr: float, x: ArrayLike, x_hat) tuple[int, int, int]
Measures the number of bit or symbol errors at the given signal-to-noise ratio (SNR).
- error_rate(snr: float) float
Returns the error rate at the specified signal-to-noise ratio (SNR).
- error_rates() tuple[NDArray[float_], NDArray[float_]]
Returns all signal-to-noise ratios (SNRs) in ascending order and their corresponding error rates.