Precoding Configuration

class SymbolPrecoding(modem=None)

Bases: hermespy.core.factory.Serializable

Channel SymbolPrecoding configuration for wireless transmission of modulated data symbols.

Symbol precoding may occur as an intermediate step between bit-mapping and base-band symbol modulations. In order to account for the possibility of multiple antenna data-streams, waveform generators may access the SymbolPrecoding configuration to encode one-dimensional symbol streams into multi-dimensional symbol streams during transmission and subsequently decode during reception.

__modem

Communication modem (transmitter or receiver) this precoding configuration is attached to.

Type

Optional[Modem]

__symbol_precoders

List of individual precoding steps. The full precoding results from a sequential execution of each precoding step.

Type

List[SymbolPrecoder]

debug

Debug flag. If enabled, the precoding will visualize the individual precoding steps after decoding.

Type

bool

Symbol Precoding object initialization.

Parameters

modem (Modem, Optional) – The modem this SymbolPrecoding configuration is attached to.

yaml_tag: Optional[str] = 'Precoding'

YAML serialization tag.

debug: bool
classmethod to_yaml(representer, node)

Serialize a SymbolPrecoding configuration to YAML.

Parameters
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (SymbolPrecoding) – The SymbolPrecoding instance to be serialized.

Returns

The serialized YAML node. None if the object state is default.

Return type

Node

classmethod from_yaml(constructor, node)

Recall a new SymbolPrecoding instance from YAML.

Parameters
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the SymbolPrecoding serialization.

Returns

Newly created SymbolPrecoding instance.

Return type

SymbolPrecoding

property modem: hermespy.modem.modem.Modem

Access the modem this SymbolPrecoding configuration is attached to.

Returns

Handle to the modem object.

Return type

Modem

Raises

RuntimeError – If the SymbolPrecoding configuration is floating.

encode(output_stream)

Encode a data symbol stream before transmission.

Parameters

output_stream (np.ndarray) – Stream of modulated data symbols feeding into the Precoder.

Returns

The encoded data streams.

Return type

np.ndarray

decode(input_stream, channel_states, stream_noises)

Decode a data symbol stream after reception.

Parameters
  • input_stream (np.ndarray) – The data streams feeding into the Precoder to be decoded. The first matrix dimension is the number of streams, the second dimension the number of discrete samples within each respective stream.

  • channel_states (ChannelStateInformation) – The channel state estimates for each input symbol within input_stream.

  • stream_noises (Union[float, np.ndarray]) – The noise variances for each data symbol within input_stream. Identical dimensionality to input_stream.

Returns

The decoded data symbols

Return type

np.array

Raises

ValueError – If dimensions of stream_responses, stream_noises and input_streams do not match.

required_outputs(precoder)

Query the number output streams of a given precoder within a transmitter.

Parameters

precoder (Precoder) – Handle to the precoder in question.

Returns

Number of streams

Return type

int

Raises

ValueError – If the precoder is not registered with this configuration.

required_inputs(precoder)

Query the number input streams of a given precoder within a receiver.

Parameters

precoder (Precoder) – Handle to the precoder in question.

Returns

Number of streams

Return type

int

Raises

ValueError – If the precoder is not registered with this configuration.

property rate: fractions.Fraction

Rate between input symbol slots and output symbol slots.

For example, a rate of one indicates that no symbols are getting added or removed during precoding.

Returns

The precoding rate.

Return type

Fraction