Utils#

PHY layer utility functions for signal processing.

Overview#

The Utils module provides:

  • Modulation - QPSK mapping and modulation utilities

  • Gold Sequences - Pseudorandom sequence generation

  • OCC Sequences - Orthogonal cover code generation

  • AWGN - Additive White Gaussian Noise utilities

API Reference#

PHY utilities: modulation and sequence helpers.

ran.phy.numpy.utils.awgn(
H: numpy.typing.NDArray.numpy.complex64,
snr_db: float,
) numpy.typing.NDArray.numpy.complex64[source]#

Add AWGN to channel.

Parameters:
  • H – Channel with shape (n_sc, n_sym, n_ant)

  • snr_db – SNR in dB

Return type:

Noisy channel

ran.phy.numpy.utils.focc_dmrs(n_dmrs_tones: int) ComplexArrayNP[source]#

Generate fOCC pattern over DMRS tones: +1, -1, +1, -1, …

Parameters:

n_dmrs_tones – Number of DMRS tones (typically 6 * n_prb)

Return type:

Complex vector of shape (n_dmrs_tones,) with alternating +/-1

ran.phy.numpy.utils.gold_sequence(c_init: int, n: int) IntArrayNP[source]#

Build a Gold sequence of length n using the same logic as the MATLAB version.

Inputs: - c_init: initial seed to Gold sequence (integer) - n: length of desired Gold sequence

Output: - c: NumPy array of shape (n,) with 0/1 entries

ran.phy.numpy.utils.qpsk_map(c: IntArrayNP | list[int], m: int) ComplexArrayNP[source]#

Map 2*m binary chips into QPSK symbols with unit average power.

Parameters:
  • c – Gold sequence chips; length must equal 2*m. Accepts list/array-like.

  • m – number of QPSK symbols to produce

Return type:

Complex array of shape (m,) with dtype complex128

ran.phy.numpy.utils.tocc_dmrs(n_dmrs_symbols: int) ComplexArrayNP[source]#

Generate tOCC pattern across DMRS symbols: +1, -1, +1, -1, …

Parameters:

n_dmrs_symbols – Number of DMRS symbols in the slot/group

Return type:

Complex vector of shape (n_dmrs_symbols,) with alternating +/-1