- class sdr.BinaryErasureChannel(sdr.Channel)
Implements a binary erasure channel (BEC).
Notes
The inputs to the BEC are \(x_i \in \mathcal{X} = \{0, 1\}\) and the outputs are \(y_i \in \mathcal{Y} = \{0, 1, e\}\). The capacity of the BEC is
\[C = 1 - p \ \ \text{bits/channel use} .\]References
John Proakis, Digital Communications, Chapter 6.5-1: Channel Models.
Examples
When 20 bits are passed through a BEC with erasure probability \(p=0.25\), roughly 5 bits are erased at the output.
In [1]: bec = sdr.BinaryErasureChannel(0.25, seed=1) In [2]: x = np.random.randint(0, 2, 20); x Out[2]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [3]: y = bec(x); y Out[3]: array([ 0, 1, -1, 0, 1, 1, 1, 1, 1, -1, 1, 0, 0, 1, 0, 0, -1, 0, -1, 1]) In [4]: np.count_nonzero(x != y) Out[4]: 4
The capacity of this BEC is 0.75 bits/channel use.
In [5]: bec.capacity Out[5]: 0.75
When the probability \(p\) of bit erasure is 0, the capacity of the channel is 1 bit/channel use. However, as the probability of erasure approaches 1, the capacity of the channel linearly approaches 0.
In [6]: p = np.linspace(0, 1, 101); \ ...: C = sdr.BinaryErasureChannel.capacities(p) ...: In [7]: plt.figure(); \ ...: plt.plot(p, C); \ ...: plt.xlabel("Erasure probability, $p$"); \ ...: plt.ylabel("Capacity (bits/channel use), $C$"); \ ...: plt.title("Capacity of the Binary Erasure Channel"); ...:
Constructors¶
Special methods¶
Methods¶
- static capacities(p: ArrayLike) NDArray[float64]
Calculates the capacity of BEC channels.
Properties¶
- property X : NDArray[np.int_]
The input alphabet \(\mathcal{X} = \{0, 1\}\) of the BEC channel.
- property Y : NDArray[np.int_]
The output alphabet \(\mathcal{Y} = \{0, 1, e\}\) of the BEC channel. Erasures \(e\) are represented by -1.