SincFilter#
- class sionna.phy.signal.SincFilter(span_in_symbols: int, samples_per_symbol: int, 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 sinc filter of
lengthK to an inputxof length N.The sinc filter is defined by
\[h(t) = \frac{1}{T}\text{sinc}\left(\frac{t}{T}\right)\]where \(T\) is 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
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 SincFilter sinc = SincFilter(span_in_symbols=8, samples_per_symbol=4) x = torch.randn(32, 100) y = sinc(x, padding="same") print(y.shape) # torch.Size([32, 100])