mokka.equalizers
Module implementing equalizers.
Equalizer blocks after channel before decoder/demodulator - in PyTorch.
- class mokka.equalizers.torch.Butterfly2x2(taps=None, num_taps=None, trainable=False, timedomain=True)
Bases:
Module
Class implementing the 2x2 complex butterfly filter structure.
This typically used in dual-polarization fiber-optical communications for equalization.
- __init__(taps=None, num_taps=None, trainable=False, timedomain=True)
Initialize Butterfly2x2 Filter.
- Parameters:
taps – filter taps for initialization.
num_taps – number of taps if no filter taps are provided for initialization
trainable – if the taps should be included in the parameters() attribute to be trainable with automatic differentiation.
- forward(y, mode='valid')
Perform 2x2 convolution with taps in self.taps.
- Params y:
Signal to convolve
- Params mode:
convolution mode (either valid, same, or full)
- Returns:
convolved signal
- forward_abssquared(y, mode='valid')
Perform 2x2 convolution with absolut-squared of taps in self.taps.
- Params y:
Signal to convolve
- Params mode:
convolution mode (either valid, same, or full)
- Returns:
convolved signal
- class mokka.equalizers.torch.Butterfly4x4(taps=None, num_taps=None, trainable=False)
Bases:
Module
Class implementing the 4x4 real-valued butterfly filter.
This structure typically used in dual-polarization fiber-optical communications. It is a simplification of the 2x2 complex-valued butterfly filter.
- __init__(taps=None, num_taps=None, trainable=False)
Initialize the Butterfly4x4 class.
- Parameters:
taps – Initial filter taps
num_taps – if taps is empty the number of taps should be set here
trainable – if filter taps should be available in parameters() for training with automatic differentiation
- class mokka.equalizers.torch.CD_compensation(dt, beta2, channel_length)
Bases:
Module
Class implementing chromatic dispersion compensation in the frequency domain.
- Parameters:
dt – sample time [s]
beta2 – dispersion coefficient of the optical fiber [ps^2/km]
channel_length – total length of the channel [km]
- __init__(dt, beta2, channel_length)
Construct CD_compensation.
- forward(y, center_freq=0)
Peform chromatic dispersion compensation in the frequency domain.
- Parameters:
y – received complex single polarization signal y
- Returns:
equalized signal
- class mokka.equalizers.torch.LinearFilter(filter_taps: Tensor, trainable: bool = False, timedomain: bool = True)
Bases:
Module
Class implementing a SISO linear filter.
Optionally with trainable filter_taps.
- __init__(filter_taps: Tensor, trainable: bool = False, timedomain: bool = True)
Initialize LinearFilter with filter taps and define if it is trainable.
- Parameters:
filter_taps – Filter taps for the linear filter
trainable – Set filter taps as
torch.nn.Parameter
timedomain – Perform convolution in time domain
- forward(y: Tensor, mode: str = 'valid')
Perform filtering of signal.
- Parameters:
y – input signal
- mokka.equalizers.torch.MU_MMSE(H, N0, tx_antenna=0, user=0)
Compute equalizer taps for given tx_antenna and user.
Specify a compound H matrix, AWGN noise power a tx_antenna index and a user index and obtain the corresponding linear equalizer matrix.
- Parameters:
H – multiuser compound H matrix with batch indices t,m,r and individual matrices of equal size RxS
- mokka.equalizers.torch.MU_MMSE_inv(H, N0)
Find inverse of multiuser compound H matrix based on multiuser MMSE algorithm.
- Parameters:
H – multiuser compound H matrix with batch indices t,m,r and individual matrices of equal size RxS
- mokka.equalizers.torch.SU_MMSE(H: Tensor, N0: float)
Compute equalizer taps according to the single user MMSE algorithm.
- Parameters:
H – Channel impulse matrix
N0 – AWGN noise power
- mokka.equalizers.torch.correct_start(signal, pilot_signal, correct_static_phase=False)
Correlate the signal with a known pilot_signal.
Return the signal aligned with the first sample of the pilot_signal. Optionally correct static_phase_offset using the maximum of the correlation
- Parameters:
signal – Single polarization complex input signal
pilot_signal – Single polarization complex pilot signal to search for
correct_static_phase – Estimate phase shift from maximum correlation value and apply phase correction to the returned aligned signal
- Returns:
Signal aligned with the first element in the pilot_signal
- mokka.equalizers.torch.correct_start_polarization(signal, pilot_signal, correct_static_phase=False, correct_polarization=True, return_phase_pol=False)
Correlate the signal with a known pilot_signal.
Return the signal aligned with the first sample of the pilot_signal. This method correlates both polarization with the pilot_signal to check for flipped polarization, e.g. after an equalizers.
- Parameters:
signal – Dual polarization complex input signal
pilot_signal – Dual polarization complex pilot signal to search for
correct_static_phase – Estimate phase shift from maximum correlation value and apply phase correction to the returned aligned signal
- Returns:
Signal aligned with the first element in the pilot_signal
- mokka.equalizers.torch.create_transmit_matrix(s_k: Tensor, L: int)
Create transmit matrix with symbols s_k and channel length L.
- Parameters:
s_k – Vector of transmit symbols
L – Maximum channel length
- mokka.equalizers.torch.find_start_offset(signal: Tensor, pilot_signal: Tensor)
Find the start offset using a pilot_signal with correlation.
- Parameters:
signal – received signal to find pilot sequence in
pilot_signal – pilot sequence to search for
- mokka.equalizers.torch.h2H(h: Tensor)
Create compound H matrix from MIMO impulse responses.
This compound H matrix consists of the expanded matrices in time domain using the Toeplitz form, then the matrices are stored accordingly in the compound matrix tensor.
- mokka.equalizers.torch.h2f(h, N0)
Construct compound H and calculate F with MMSE/ZF.
(depending on the setting of N0) and return the filter taps for f
- Parameters:
h – impulse response in time domain h_{t,m,r} for each user/transmit/receive combination
N0 – white noise at receiver
- mokka.equalizers.torch.impulse_response_to_toeplitz(h)
Take an impulse response and convert into matrix form.
- mokka.equalizers.torch.pad_transmit_vector(s: Tensor)
Add padding to the transmit vector.
- Parameters:
s – Transmit vector to be padded by 100 zeros on each side.
- mokka.equalizers.torch.toeplitz(c, r)
Adapted from https://stackoverflow.com/a/68899386 with modifications.
- mokka.equalizers.torch.unit_vector(tau: int, S: int)
One-hot vector to select symbols at delay tau.
- Parameters:
tau – Delay to generate unit_vector for
S – Length of the vector
- Returns:
unit vector with impulse at delay tau