pyphysim.reference_signals package

Submodules

pyphysim.reference_signals.channel_estimation module

Module with channel estimation implementations based on the reference signals in this package.

class pyphysim.reference_signals.channel_estimation.CazacBasedChannelEstimator(ue_ref_seq: Union[pyphysim.reference_signals.srs.SrsUeSequence, pyphysim.reference_signals.dmrs.DmrsUeSequence, numpy.ndarray], size_multiplier: int = 2)[source]

Bases: object

Estimated the (uplink) channel based on CAZAC (Constant Amplitude Zero AutoCorrelation) reference sequences sent by one user (either SRS or DMRS).

The estimation is performed according to the paper [Bertrand2011], where the received signal in the FREQUENCY DOMAIN is used by the estimator.

Note that for SRS sequences usually a comb pattern is employed such that only half of the subcarriers is used to send pilot symbols. Therefore, an FFT in the during the estimation will effectively interpolate for the other subcarriers. This is controlled by the size_multiplier argument (default is 2 to accommodate comb pattern). If all subcarriers are used to send pilot symbols then set size_multiplier to 1.

Parameters
  • ue_ref_seq (SrsUeSequence | DmrsUeSequence | np.ndarray) – The reference signal sequence.

  • size_multiplier (int, optional) – Multiplication factor for the FFT to get the actual channel size. When using the comb pattern for SRS this should be 2 (default value), but for DMRS, which does not employ the comb pattern, this should be set to 1.

Notes

Bertrand2011

Bertrand, Pierre, “Channel Gain Estimation from Sounding Reference Signal in LTE,” Conference: Proceedings of the 73rd IEEE Vehicular Technology Conference.

estimate_channel_freq_domain(received_signal: numpy.ndarray, num_taps_to_keep: int)numpy.ndarray[source]

Estimate the channel based on the received signal.

Parameters
  • received_signal (np.ndarray) – The received reference signal after being transmitted through the channel (in the frequency domain). If this is a 2D numpy array the first dimensions is assumed to be “receive antennas” while the second dimension are the received sequence elements. The number of elements in the received signal (per antenna) is equal to the channel size (number of subcarriers) divided by size_multiplier.

  • num_taps_to_keep (int) – Number of taps (in delay domain) to keep. All taps from 0 to num_taps_to_keep-1 will be kept and all other taps will be zeroed before applying the FFT to get the channel response in the frequency domain.

Returns

freq_response – The channel frequency response. Note that for SRS sequences this will have twice as many elements as the sent SRS signal, since the SRS signal is sent every other subcarrier.

Return type

np.ndarray

property ue_ref_seq

Get the sequence of the UE.

class pyphysim.reference_signals.channel_estimation.CazacBasedWithOCCChannelEstimator(ue_ref_seq: pyphysim.reference_signals.dmrs.DmrsUeSequence)[source]

Bases: pyphysim.reference_signals.channel_estimation.CazacBasedChannelEstimator

Estimated the (uplink) channel based on CAZAC (Constant Amplitude Zero AutoCorrelation) reference sequences sent by one user including the Orthogonal Cover Code (OCC).

With OCC the user will send reference signal in multiple time slots, in each slot multiplied with the respective OCC sequence element.

Parameters

ue_ref_seq (DmrsUeSequence) – The reference signal sequence.

property cover_code

Get the cover code of the UE.

estimate_channel_freq_domain(received_signal: numpy.ndarray, num_taps_to_keep: int, extra_dimension: bool = True)numpy.ndarray[source]

Estimate the channel based on the received signal with cover codes.

Parameters
  • received_signal (np.ndarray) –

    The received reference signal after being transmitted through the channel (in the frequency domain).

    Dimension: Depend if there are multiple receive antennas and if extra_dimension is True or False. Let \(Nr\) be the number of receive antennas, \(Ne\) be the number of reference signal elements (reference signal size without cover code) and \(Nc\) be the cover code size. The dimension of received_signal must match the table below.

    /

    extra_dimension: True

    extra_dimension: False

    Single Antenna

    Nc x Ne (2D)

    Ne * Nc (1D)

    Multiple Antennas

    Nr x Nc x Ne (3D)

    Nr x (Ne * Nc) (2D)

  • num_taps_to_keep (int) – Number of taps (in delay domain) to keep. All taps from 0 to num_taps_to_keep-1 will be kept and all other taps will be zeroed before applying the FFT to get the channel response in the frequency domain.

  • extra_dimension (bool) – If True then the should be an extra dimension in received_signal corresponding to the cover code dimension. If False then the cover code is included in the dimension of the reference signal elements.

Returns

freq_response – The channel frequency response.

Return type

np.ndarray

pyphysim.reference_signals.dmrs module

Module with Sounding Reference Signal (SRS) related functions

class pyphysim.reference_signals.dmrs.DmrsUeSequence(root_seq: pyphysim.reference_signals.root_sequence.RootSequence, n_cs: int, cover_code: Optional[numpy.ndarray] = None, normalize: bool = False)[source]

Bases: pyphysim.reference_signals.srs.UeSequence

DMRS sequence of a single user.

Parameters
  • root_seq (RootSequence) – The DMRS root sequence of the base station the user is associated to. This should be an object of the RootSequence class.

  • n_cs (int) – The shift index of the user. This can be an integer from 0 to 11.

  • cover_code (np.ndarray, optional) – Cover Code used by the UE. As an example, consider the cover code np.array([1, -1]). In that case, if the regular DMRS sequence (without the cover code) is seq, than the actual DMRS sequence with cover code will be a 2D numpy array equivalent with seq_occ[0]==seq and seq_occ[1]==-seq.

  • normalize (bool) – True if the reference signal should be normalized. False otherwise.

property cover_code

Return the cover code.

property size

Return the size of the reference signal sequence.

Returns

size – The size of the user’s reference signal sequence.

Return type

int

pyphysim.reference_signals.dmrs.get_dmrs_seq(root_seq: numpy.ndarray, n_cs: int)numpy.ndarray[source]

Get the shifted root sequence suitable as the DMRS sequence of a user.

Parameters
  • root_seq (np.ndarray) – The root sequence to shift.

  • n_cs (int) – The desired cyclic shift number. This should be an integer from 0 to 11, where 0 will just return the base sequence, 1 gives the first shift, and so on.

Returns

The shifted root sequence.

Return type

np.ndarray

pyphysim.reference_signals.root_sequence module

Module with Sounding Reference Signal (SRS) related functions

class pyphysim.reference_signals.root_sequence.RootSequence(root_index: int, size: Optional[int] = None, Nzc: Optional[int] = None)[source]

Bases: object

Class representing the root sequence of the reference signals.

The root sequence is generated using two possible formulas, one used for a sequence size smaller than \(3M_{sc}^{RS}\) and another for sequence size equal to or greater than \(3M_{sc}^{RS}\), where \(3M_{sc}^{RS}\) is the number of subcarriers in a PRB (12 subcarriers).

Parameters
  • root_index (int) – The SRS root sequence index.

  • size (int) – The size of the extended Zadoff-Chu sequence. If None then the sequence will not be extended and will thus have a size equal to Nzc.

  • Nzc (int) – The size of the Zadoff-Chu sequence (without any extension). If not provided then the largest prime number lower than or equal to size will be used.

property Nzc

Get the size of the Zadoff-Chu sequence (without any extension).

Returns

The value of the Nzc property.

Return type

int

static _get_largest_prime_lower_than_number(seq_size: int)int[source]

Get the largest prime number lower than seq_size.

Parameters

seq_size (int) – The sequence size.

Returns

The largest prime number lower than seq_size.

Return type

int

conj()numpy.ndarray[source]

Return the conjugate of the root sequence as a numpy array.

Returns

The conjugate of the root sequence.

Return type

np.ndarray

conjugate()numpy.ndarray[source]

Return the conjugate of the root sequence as a numpy array.

Returns

The conjugate of the root sequence.

Return type

np.ndarray

property index

Return the SRS root sequence index.

Returns

The root sequence index.

Return type

int

n_sc_PRB = 12
seq_array()numpy.ndarray[source]

Get the extended Zadoff-Chu root sequence as a numpy array.

Returns

seq – The extended Zadoff-Chu sequence

Return type

np.ndarray

property size

Return the size (with extension) of the sequence.

If the sequence is not extended than size() will return the same as Nzc.

Returns

size – The size of the extended Zadoff-Chu sequence.

Return type

int

Examples

>>> seq1 = RootSequence(root_index=25, Nzc=139)
>>> seq1.size
139
>>> seq1 = RootSequence(root_index=25, Nzc=139, size=150)
>>> seq1.size
150

pyphysim.reference_signals.srs module

Module with Sounding Reference Signal (SRS) related functions

class pyphysim.reference_signals.srs.SrsUeSequence(root_seq: pyphysim.reference_signals.root_sequence.RootSequence, n_cs: int, normalize: bool = False)[source]

Bases: pyphysim.reference_signals.srs.UeSequence

SRS sequence of a single user.

Parameters
  • root_seq (RootSequence) – The SRS root sequence of the base station the user is associated to. This should be an object of the RootSequence class.

  • n_cs (int) – The shift index of the user. This can be an integer from 0 to 7.

  • normalize (bool) – True if the reference signal should be normalized. False otherwise.

pyphysim.reference_signals.srs.get_srs_seq(root_seq: numpy.ndarray, n_cs: int)numpy.ndarray[source]

Get the shifted root sequence suitable as the SRS sequence of a user.

Parameters
  • root_seq (np.ndarray) – The root sequence to shift. This is a complex numpy array.

  • n_cs (int) – The desired cyclic shift number. This should be an integer from 0 to 7, where 0 will just return the base sequence, 1 gives the first shift, and so on.

Returns

The shifted root sequence.

Return type

np.ndarray

pyphysim.reference_signals.zadoffchu module

Module containing Zadoff-chu related functions.

pyphysim.reference_signals.zadoffchu.calcBaseZC(Nzc: int, u: int, q: complex = 0)numpy.ndarray[source]

Calculate the root sequence of Zadoff-Chu sequences.

Parameters
  • Nzc (int) – The size of the root Zadoff-Chu sequence.

  • u (int) – The root sequence index.

  • q (complex) – Any complex number. Usually this is just zero.

Returns

a_u – The root Zadoff-Chu sequence.

Return type

np.ndarray

pyphysim.reference_signals.zadoffchu.get_extended_ZF(root_seq: numpy.ndarray, size: int)numpy.ndarray[source]

Cyclic Extend the Zadoff-Chu root sequence to have size equal to size.

Parameters
  • root_seq (np.ndarray) – The root Zadoff-Chu sequence. This is a complex numpy array.

  • size (int) – The size that the sequence should be extended to.

Returns

output – The extended root sequence.

Return type

np.ndarray

Examples

>>> root_seq = np.array([1, 2, 3, 4, 5])
>>> get_extended_ZF(root_seq, 8)
array([1, 2, 3, 4, 5, 1, 2, 3])
pyphysim.reference_signals.zadoffchu.get_shifted_root_seq(root_seq: numpy.ndarray, n_cs: int, denominator: int)numpy.ndarray[source]

Get the shifted root sequence suitable as the SRS sequence or the DMRS sequence of a user (depend on the denominator parameter).

Parameters
  • root_seq (np.ndarray) – The root sequence to be shifted. This is a complex numpy array.

  • n_cs (int) – The desired cyclic shift number. This should be an integer from 0 to denominator-1, where 0 will just return the base sequence, 1 gives the first shift, and so on.

  • denominator (int) – The denominator in the cyclic shift formula. This should be 8 for SRS and 12 for DMRS.

Returns

The shifted root sequence (a complex numpy array).

Return type

np.ndarray

See also

get_srs_seq(), get_dmrs_seq()

Module contents

Package for Uplink Reference Signals related functionality.