Bit Source

Bit sources represent, as the title suggest, a source of (hard) communication bits to be transmitted over a modem. Every bit source implementation is expected to inherit from the BitsSource base class, which in turn represents a random node.

classDiagram RandomNode <|-- BitsSource BitsSource <|-- RandomBitsSource Serializable <|-- RandomBitsSource BitsSource <|-- StreamBitsSource Serializable <|-- StreamBitsSource

There are currently two basic types of bit sources available:

class BitsSource(seed=None)

Bases: abc.ABC, hermespy.core.random_node.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)

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)

Bases: hermespy.modem.bits_source.BitsSource, hermespy.core.factory.Serializable

Bit stream generator for pseudo-random sequences of bits.

Parameters

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

yaml_tag: Optional[str] = 'RandomBits'

YAML serialization tag.

generate_bits(num_bits)

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)

Bases: hermespy.modem.bits_source.BitsSource, hermespy.core.factory.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)

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