mokka.pulseshaping
Module implementing pulseshaping.
Module implementing pulseshaping with PyTorch.
- class mokka.pulseshaping.torch.MidriseQuantizer(bit, max_amplitude=1.0)
Bases:
Module
A Quantizer which translates a continuos signal into 2**m levels.
This quantizer operates on a real-valued signal and quantizes between [-max_amplitude,max_amplitude].
- __init__(bit, max_amplitude=1.0)
Construct MidriseQuuantizer.
- Parameters:
bit – number of input bits, this will give 2**bit quantization levels
max_amplitude – Maximum amplitude before saturation.
- forward(y)
Perform quantization.
- Parameters:
y – real-valued signal to quantize
- class mokka.pulseshaping.torch.PulseShaping(impulse_response: tensor, learnable: bool = False)
Bases:
Module
PulseShaping filter class.
Several classical shapes, a filter function and a matched filter function are provided.
- __init__(impulse_response: tensor, learnable: bool = False) None
Method generated by attrs for class PulseShaping.
- forward(y, n_up)
Perform pulse shaping.
- Parameters:
y – transmit signal
n_up – upsampling factor
- Returns:
shaped and upsampled transmit signal at sample rate
- classmethod get_rc_ir(syms, r, n_up, learnable=False, normalize=True, normalize_symbol=False)
Determine normed coefficients of an RC filter.
Formula out of: K.-D. Kammeyer, Nachrichtenübertragung At poles, l’Hospital was used
- Parameters:
syms – “normed” length of ir. ir-length will be 2*syms+1
r – roll-off factor [Float]
n_up – upsampling factor [Int]
- Returns:
tuple containing time-index-array and impulse response in an array
- classmethod get_rrc_ir(syms, r, n_up, learnable=False, normalize=True, normalize_symbol=False)
Determine normed coefficients of an RRC filter.
This function is adapted from Sourcecode written by Dominik Rimpf and was published under the MIT license [https://gitlab.com/domrim/bachelorarbeit-code]
Formula out of: K.-D. Kammeyer, Nachrichtenübertragung At poles, l’Hospital was used
- Parameters:
syms – “normed” length of ir. ir-length will be 2*syms+1
r – roll-off factor [Float]
n_up – upsampling factor [Int]
- Returns:
tuple containing time-index-array and impulse response in an array
- impulse_response_conj: tensor
- learnable: bool
- matched(r, n_down, max_energy=False)
Perform matched filtering.
This function assumes perfect timing sync.
- Parameters:
r – received complex signal
n_down – downsampling factor
- Returns:
filtered and downsampled signal at symbol rate
- normalize_filter()
Normalize filter taps saved in this object.
- class mokka.pulseshaping.torch.SoftMidriseQuantizer(bit, max_amplitude=1.0, temperature=0.01)
Bases:
Module
Use tanh() with temperature to approximate Midrise quantization.
For temperature -> 0 the SoftMidriseQuantizer approximates the MidriseQuantizer.
- __init__(bit, max_amplitude=1.0, temperature=0.01)
Initialize SoftMidriseQuantizer.
- Parameters:
bit – number of bits to quantize. This will give 2**bit quantization levels.
max_amplitude – Maximum amplitude before saturation.
temperature – scale input to tanh to achieve a steeper quantization.
- forward(x)
Apply quantization to signal.
- Parameters:
x – real signal to quantize.
- Returns:
Soft quantized signal.
- mokka.pulseshaping.torch.blackman_harris_window(length=501)
Get Blackman-harris window coefficients.
- Parameters:
length – number of window taps
- mokka.pulseshaping.torch.brickwall_filter(cutoff, filter_length, filter_gain, window='hann', dtype=torch.complex64)
Approximate brickwall filter in fourier domain with configurable window.
- mokka.pulseshaping.torch.cosine_sum_window(coeffs, length=501)
Get cosine sum window coefficients.
- Parameters:
coeffs – \(a_k\) coefficients to calculate cosine sum window
- mokka.pulseshaping.torch.downsample(n_down, signal, filter_length=501, filter_gain=1, window='blackmann_harris')
Perform downsampling on signal.
- Parameters:
n_down – downsampling factor
signal – signal to downsample
filter_length – number of filter taps to use for the brickwall filter
filter_gain – gain to apply to brickwall filter
- mokka.pulseshaping.torch.hamming_window(length=501)
Get Hamming window coefficients.
- Parameters:
length – number of window taps
- mokka.pulseshaping.torch.hann_window(length=501)
Get Hann window coefficients.
- Parameters:
length – number of window taps
- mokka.pulseshaping.torch.upsample(n_up, signal, filter_length=501, filter_gain=1)
Perform upsampling on signal.
- Parameters:
n_up – upsampling factor
signal – signal to upsample
- Filter_length:
number of filter taps of the brickwall interpolation filter
- Filter_gain:
gain to apply to brickwall filter