-
sdr.bsc(x: ArrayLike, p: float, seed: int | None =
None
) NDArray[int_] Passes the binary input sequence \(x\) through a binary symmetric channel (BSC) with transition probability \(p\).
Examples¶
When 20 bits are passed through a BSC with transition probability \(p=0.25\), roughly 5 bits are flipped at the output.
In [1]: x = np.random.randint(0, 2, 20); x Out[1]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [2]: y = sdr.bsc(x, 0.25); y Out[2]: array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1]) In [3]: x == y Out[3]: array([ True, False, False, True, False, True, True, True, True, True, False, True, True, True, True, True, False, True, True, True])