Bit Sources

Inheritance diagram of hermespy.modem.bits_source.RandomBitsSource, hermespy.modem.bits_source.StreamBitsSource, hermespy.modem.bits_source.BitsSource

Bit sources represent, as the title suggest, a source of (hard) communication bits to be transmitted over a modem. They are one of the default configuration parameters of a TransmittingModem.

Every bit source implementation is expected to inherit from the BitsSource base class, which in turn represents a random node. There are currently two basic types of bit sources available:

class BitsSource(seed=None)[source]

Bases: ABC, RandomNode

Base Class for Arbitrary Streams of Communication Bits.

Inheriting classes are required to implement the generate_bits() routine.

Parameters:

seed (int, optional) – Seed used to initialize the pseudo-random number generator.

abstract generate_bits(num_bits)[source]

Generate a new sequence of bits.

Parameters:

num_bits (int) – Number of bits to be generated.

Returns:

A numpy vector of num_bits generated bits.

Return type:

np.ndarray

class RandomBitsSource(seed=None)[source]

Bases: BitsSource, Serializable

Bit stream generator for pseudo-random sequences of bits.

Parameters:

seed (int, optional) – Seed used to initialize the pseudo-random number generator.

generate_bits(num_bits)[source]

Generate a new sequence of bits.

Parameters:

num_bits (int) – Number of bits to be generated.

Returns:

A numpy vector of num_bits generated bits.

Return type:

np.ndarray

class StreamBitsSource(path)[source]

Bases: BitsSource, Serializable

Bit-stream generator mapping representing file system streams as bit sources.

Parameters:

path (str) – Path to the stream bits source.

generate_bits(num_bits)[source]

Generate a new sequence of bits.

Parameters:

num_bits (int) – Number of bits to be generated.

Returns:

A numpy vector of num_bits generated bits.

Return type:

np.ndarray