-
sdr.bec(x: ArrayLike, p: float, seed: int | None =
None
) NDArray[int_] Passes the binary input sequence
through a binary erasure channel (BEC).Examples¶
When 20 bits are passed through a BEC with erasure probability
, roughly 5 bits are erased 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.bec(x, 0.25); y Out[2]: array([ 0, -1, 1, 0, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 0, -1, -1, 0, 0, 1]) In [3]: x == y Out[3]: array([ True, False, True, True, True, True, True, True, True, False, True, False, False, True, True, False, False, True, True, True])