optic.comm.sources.bitSource

bitSource(param)

Generate a sequence of bits of length nBits either as a random bit sequence or a pseudo-random binary sequence (PRBS).

Parameters:

param (optic.utils.parameters) –

Parameters for the bit source:

  • nBits : int, optional. The number of bits in the sequence. [default: 1000]

  • mode : str, optional. The mode of the bit generation. If ‘random’, a sequence of random bits is generated. If ‘prbs’, a pseudo-random binary sequence (PRBS) is generated [default: ‘random’].

  • order : int, optional. The order of the PRBS generator. Only used if mode is ‘prbs’ [default: 23].

  • seed : int, optional. The seed for the random number generator. Only applicable when mode is ‘random’ [default: None].

Returns:

bits – An array of bits of length nBits, either randomly generated or from a PRBS.

Return type:

np.array

References

[1] Wikipedia, “Pseudorandom binary sequence,” https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence

[2] Proakis, J. G., & Salehi, M. Digital Communications (5th Edition). McGraw-Hill Education, 2008.