Filter#
- class sionna.phy.signal.Filter(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.block.BlockAbstract class defining a filter of
lengthK which can be applied to an inputxof length N.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.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 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
- property window: sionna.phy.signal.window.Window | None#
Get/set window function applied to filter coefficients
- property coefficients: torch.Tensor#
Set/get raw filter coefficients
- property sampling_times: numpy.ndarray#
Sampling times in multiples of the symbol duration
Methods
- show(response: Literal['impulse', 'magnitude'] = 'impulse', scale: Literal['lin', 'db'] = 'lin') None[source]#
Plot the impulse or magnitude response.
Plots the impulse response (time domain) or magnitude response (frequency domain) of the filter.
For the computation of the magnitude response, a minimum DFT size of 1024 is assumed which is obtained through zero padding of the filter coefficients in the time domain.
- property aclr: torch.Tensor#
torch.float – ACLR of the filter in linear scale.
This ACLR corresponds to what one would obtain from using this filter as pulse shaping filter on an i.i.d. sequence of symbols. The in-band is assumed to range from [-0.5, 0.5] in normalized frequency.