RootRaisedCosineFilter#
- class sionna.phy.signal.RootRaisedCosineFilter(span_in_symbols: int, samples_per_symbol: int, beta: float, window: sionna.phy.signal.window.Window | str | None = None, normalize: bool = True, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.signal.filter.FilterBlock for applying a root-raised-cosine filter of
lengthK to an inputxof length N.The root-raised-cosine filter is defined by
\[\begin{split}h(t) = \begin{cases} \frac{1}{T} \left(1 + \beta\left(\frac{4}{\pi}-1\right) \right), & \text { if }t = 0\\ \frac{\beta}{T\sqrt{2}} \left[ \left(1+\frac{2}{\pi}\right)\sin\left(\frac{\pi}{4\beta}\right) + \left(1-\frac{2}{\pi}\right)\cos\left(\frac{\pi}{4\beta}\right) \right], & \text { if }t = \pm\frac{T}{4\beta} \\ \frac{1}{T} \frac{\sin\left(\pi\frac{t}{T}(1-\beta)\right) + 4\beta\frac{t}{T}\cos\left(\pi\frac{t}{T}(1+\beta)\right)}{\pi\frac{t}{T}\left(1-\left(4\beta\frac{t}{T}\right)^2\right)}, & \text { otherwise} \end{cases}\end{split}\]where \(\beta\) is the roll-off factor and \(T\) the symbol duration.
The filter length K is equal to the filter span in symbols (
span_in_symbols) multiplied by the oversampling factor (samples_per_symbol). If this product is even, a value of one will be added.The filter is applied through discrete convolution.
An optional windowing function
windowcan be applied to the filter.The dtype of the output is torch.float if both
xand the filter coefficients have dtype torch.float. Otherwise, the dtype of the output is torch.complex.Three padding modes are available for applying the filter:
“full” (default): Returns the convolution at each point of overlap between
xand the filter. The length of the output is N + K - 1. Zero-padding of the inputxis performed to compute the convolution at the borders.“same”: Returns an output of the same length as the input
x. The convolution is computed such that the coefficients of the inputxare centered on the coefficient of the filter with index (K-1)/2. Zero-padding of the input signal is performed to compute the convolution at the borders.“valid”: Returns the convolution only at points where
xand the filter completely overlap. The length of the output is N - K + 1.
- Parameters:
span_in_symbols (int) – Filter span as measured by the number of symbols
samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor
beta (float) – Roll-off factor. Must be in the range \([0,1]\).
window (sionna.phy.signal.window.Window | str | None) – Window that is applied to the filter coefficients. Can be None, a
Windowinstance, or one of"hann","hamming","blackman".normalize (bool) – If True, the filter is normalized to have unit power. Defaults to True.
precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None,
precisionis used.device (str | None) – Device for computation. If None,
deviceis used.
- Inputs:
x – […, N], torch.complex or torch.float. Input to which the filter is applied along the last dimension.
padding – “full” (default) | “valid” | “same”. Padding mode for convolving
xand the filter.conjugate – bool, (default False). If True, the complex conjugate of the filter is applied.
- Outputs:
y – […, M], torch.complex or torch.float. Filtered input. The length M depends on the
padding.
Examples
import torch from sionna.phy.signal import RootRaisedCosineFilter rrc = RootRaisedCosineFilter(span_in_symbols=8, samples_per_symbol=4, beta=0.35) x = torch.randn(32, 100) y = rrc(x, padding="same") print(y.shape) # torch.Size([32, 100])
Attributes