Signal

This module contains classes and functions forfiltering (pulse shaping),windowing, andup- anddownsampling.The following figure shows the different components that can be implemented using this module.

../../_images/signal_module.png

This module also containsutility functions for computing the (inverse) discrete Fourier transform (FFT/IFFT), and for empirically computing thepower spectral density (PSD) andadjacent channel leakage ratio (ACLR) of a signal.

The following code snippet shows how to filter a sequence of QAM baseband symbols using a root-raised-cosine filter with a Hann window:

# Create batch of QAM-16 sequencesbatch_size=128num_symbols=1000num_bits_per_symbol=4x=QAMSource(num_bits_per_symbol)([batch_size,num_symbols])# Create a root-raised-cosine filter with Hann windowingbeta=0.22# Roll-off factorspan_in_symbols=32# Filter span in symbolssamples_per_symbol=4# Number of samples per symbol, i.e., the oversampling factorrrcf_hann=RootRaisedCosineFilter(span_in_symbols,samples_per_symbol,beta,window="hann")# Create instance of the Upsampling layerus=Upsampling(samples_per_symbol)# Upsample the baseband xx_us=us(x)# Filter the upsampled sequencex_rrcf=rrcf_hann(x_us)

On the receiver side, one would recover the baseband symbols as follows:

# Instantiate a downsampling layerds=Downsampling(samples_per_symbol,rrcf_hann.length-1,num_symbols)# Apply the matched filterx_mf=rrcf_hann(x_rrcf)# Recover the transmitted symbol sequencex_hat=ds(x_mf)

Filters

classsionna.phy.signal.SincFilter(span_in_symbols,samples_per_symbol,window=None,normalize=True,precision=None,**kwargs)[source]

Block for applying a sinc filter oflength Kto an inputx of length N

The sinc filter is defined by

\[h(t) = \frac{1}{T}\text{sinc}\left(\frac{t}{T}\right)\]

where\(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 functionwindow can be applied to the filter.

Thedtype of the output istf.float if bothx and the filter coefficients have dtypetf.float.Otherwise, the dtype of the output istf.complex.

Three padding modes are available for applying the filter:

  • “full” (default): Returns the convolution at each point of overlap betweenx and the filter.The length of the output is N + K - 1. Zero-padding of the inputx is performed tocompute the convolution at the borders.

  • “same”: Returns an output of the same length as the inputx. The convolution is computed suchthat the coefficients of the inputx are 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 wherex and 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 (None (default) |Window | “hann” | “hamming” | “blackman”) – Window that is applied to the filter coefficients

  • normalize (bool, (defaultTrue)) – IfTrue, the filter is normalized to have unit power

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:
  • x ([…,N],tf.complex ortf.float) – Input to which the filter is applied along the last dimension

  • padding (“full” (default) | “valid” | “same”) – Padding mode for convolvingx and the filter

  • conjugate (bool, (defaultFalse)) – IfTrue, the complex conjugate of the filter is applied.

Output:

y ([…,M],tf.complex ortf.float) – Filtered input. The length M depends on thepadding.

propertyaclr

ACLR of the filter

This ACLR corresponds to what one would obtain from usingthis 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 normalizedfrequency.

tf.float : ACLR in linear scale

propertycoefficients

Set/get raw filter coefficients

Type:

[K],tf.float oftf.complex

propertylength

Filter length in samples

Type:

int

propertynormalize

IfTrue the filter is normalized to have unit power.

Type:

bool

propertysampling_times

Sampling times in multiples ofthe symbol duration

Type:

[K],numpy.float32

show(response='impulse',scale='lin')

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 sizeof 1024 is assumed which is obtained through zero padding ofthe filter coefficients in the time domain.

Input:
  • response (“impulse” (default) | “magnitude”) – Desired response type

  • scale (“lin” (default) | “db”) – y-scale of the magnitude response.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

propertywindow

Get/set window function thatis applied to the filter coefficients

Type:

Window

classsionna.phy.signal.RaisedCosineFilter(span_in_symbols,samples_per_symbol,beta,window=None,normalize=True,precision=None,**kwargs)[source]

Block for applying a raised-cosine filter oflength Kto an inputx of length N

The raised-cosine filter is defined by

\[\begin{split}h(t) =\begin{cases}\frac{\pi}{4T} \text{sinc}\left(\frac{1}{2\beta}\right), & \text { if }t = \pm \frac{T}{2\beta}\\\frac{1}{T}\text{sinc}\left(\frac{t}{T}\right)\frac{\cos\left(\frac{\pi\beta t}{T}\right)}{1-\left(\frac{2\beta t}{T}\right)^2}, & \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 functionwindow can be applied to the filter.

Thedtype of the output istf.float if bothx and the filter coefficients have dtypetf.float.Otherwise, the dtype of the output istf.complex.

Three padding modes are available for applying the filter:

  • “full” (default): Returns the convolution at each point of overlap betweenx and the filter.The length of the output is N + K - 1. Zero-padding of the inputx is performed tocompute the convolution at the borders.

  • “same”: Returns an output of the same length as the inputx. The convolution is computed suchthat the coefficients of the inputx are 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 wherex and 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 (None (default) |Window | “hann” | “hamming” | “blackman”) – Window that is applied to the filter coefficients

  • normalize (bool, (defaultTrue)) – IfTrue, the filter is normalized to have unit power.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:
  • x ([…,N],tf.complex ortf.float) – Input to which the filter is applied along the last dimension

  • padding (“full” (default) | “valid” | “same”) – Padding mode for convolvingx and the filter

  • conjugate (bool, (defaultFalse)) – IfTrue, the complex conjugate of the filter is applied.

Output:

y ([…,M],tf.complex ortf.float) – Filtered input. The length M depends on thepadding.

propertyaclr

ACLR of the filter

This ACLR corresponds to what one would obtain from usingthis 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 normalizedfrequency.

tf.float : ACLR in linear scale

propertybeta

Roll-off factor

Type:

float

propertycoefficients

Set/get raw filter coefficients

Type:

[K],tf.float oftf.complex

propertylength

Filter length in samples

Type:

int

propertynormalize

IfTrue the filter is normalized to have unit power.

Type:

bool

propertysampling_times

Sampling times in multiples ofthe symbol duration

Type:

[K],numpy.float32

show(response='impulse',scale='lin')

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 sizeof 1024 is assumed which is obtained through zero padding ofthe filter coefficients in the time domain.

Input:
  • response (“impulse” (default) | “magnitude”) – Desired response type

  • scale (“lin” (default) | “db”) – y-scale of the magnitude response.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

propertywindow

Get/set window function thatis applied to the filter coefficients

Type:

Window

classsionna.phy.signal.RootRaisedCosineFilter(span_in_symbols,samples_per_symbol,beta,window=None,normalize=True,precision=None,**kwargs)[source]

Block for applying a root-raised-cosine filter oflength Kto an inputx of 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 functionwindow can be applied to the filter.

Thedtype of the output istf.float if bothx and the filter coefficients have dtypetf.float.Otherwise, the dtype of the output istf.complex.

Three padding modes are available for applying the filter:

  • “full” (default): Returns the convolution at each point of overlap betweenx and the filter.The length of the output is N + K - 1. Zero-padding of the inputx is performed tocompute the convolution at the borders.

  • “same”: Returns an output of the same length as the inputx. The convolution is computed suchthat the coefficients of the inputx are 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 wherex and 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 (None (default) |Window | “hann” | “hamming” | “blackman”) – Window that is applied to the filter coefficients

  • normalize (bool, (defaultTrue)) – IfTrue, the filter is normalized to have unit power.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:
  • x ([…,N],tf.complex ortf.float) – Input to which the filter is applied along the last dimension

  • padding (“full” (default) | “valid” | “same”) – Padding mode for convolvingx and the filter

  • conjugate (bool, (defaultFalse)) – IfTrue, the complex conjugate of the filter is applied.

Output:

y ([…,M],tf.complex ortf.float) – Filtered input. The length M depends on thepadding.

propertyaclr

ACLR of the filter

This ACLR corresponds to what one would obtain from usingthis 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 normalizedfrequency.

tf.float : ACLR in linear scale

propertybeta

Roll-off factor

Type:

float

propertycoefficients

Set/get raw filter coefficients

Type:

[K],tf.float oftf.complex

propertylength

Filter length in samples

Type:

int

propertynormalize

IfTrue the filter is normalized to have unit power.

Type:

bool

propertysampling_times

Sampling times in multiples ofthe symbol duration

Type:

[K],numpy.float32

show(response='impulse',scale='lin')

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 sizeof 1024 is assumed which is obtained through zero padding ofthe filter coefficients in the time domain.

Input:
  • response (“impulse” (default) | “magnitude”) – Desired response type

  • scale (“lin” (default) | “db”) – y-scale of the magnitude response.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

propertywindow

Get/set window function thatis applied to the filter coefficients

Type:

Window

classsionna.phy.signal.CustomFilter(samples_per_symbol,coefficients,window=None,normalize=True,precision=None,**kwargs)[source]

Block for applying a custom filter oflength Kto an inputx of 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 functionwindow can be applied to the filter.

Thedtype of the output istf.float if bothx and the filter coefficients have dtypetf.float.Otherwise, the dtype of the output istf.complex.

Three padding modes are available for applying the filter:

  • “full” (default): Returns the convolution at each point of overlap betweenx and the filter.The length of the output is N + K - 1. Zero-padding of the inputx is performed tocompute the convolution at the borders.

  • “same”: Returns an output of the same length as the inputx. The convolution is computed suchthat the coefficients of the inputx are 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 wherex and the filter completely overlap.The length of the output is N - K + 1.

Parameters:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • coefficients ([K],tf.float ortf.complex) – Filter coefficients

  • window (None (default) |Window | “hann” | “hamming” | “blackman”) – Window that is applied to the filter coefficients

  • normalize (bool, (defaultTrue)) – IfTrue, the filter is normalized to have unit power.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:
  • x ([…,N],tf.complex ortf.float) – Input to which the filter is applied along the last dimension

  • padding (“full” (default) | “valid” | “same”) – Padding mode for convolvingx and the filter

  • conjugate (bool, (defaultFalse)) – IfTrue, the complex conjugate of the filter is applied.

Output:

y ([…,M],tf.complex ortf.float) – Filtered input. The length M depends on thepadding.

propertyaclr

ACLR of the filter

This ACLR corresponds to what one would obtain from usingthis 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 normalizedfrequency.

tf.float : ACLR in linear scale

propertycoefficients

Set/get raw filter coefficients

Type:

[K],tf.float oftf.complex

propertylength

Filter length in samples

Type:

int

propertynormalize

IfTrue the filter is normalized to have unit power.

Type:

bool

propertysampling_times

Sampling times in multiples ofthe symbol duration

Type:

[K],numpy.float32

show(response='impulse',scale='lin')

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 sizeof 1024 is assumed which is obtained through zero padding ofthe filter coefficients in the time domain.

Input:
  • response (“impulse” (default) | “magnitude”) – Desired response type

  • scale (“lin” (default) | “db”) – y-scale of the magnitude response.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

propertywindow

Get/set window function thatis applied to the filter coefficients

Type:

Window

classsionna.phy.signal.Filter(span_in_symbols,samples_per_symbol,window=None,normalize=True,precision=None,**kwargs)[source]

Abtract class defining a filter oflength K which can beapplied to an inputx of 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 functionwindow can be applied to the filter.

Three padding modes are available for applying the filter:

  • “full” (default): Returns the convolution at each point of overlap betweenx and the filter.The length of the output is N + K - 1. Zero-padding of the inputx is performed tocompute the convolution at the borders.

  • “same”: Returns an output of the same length as the inputx. The convolution is computed suchthat the coefficients of the inputx are 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 wherex and 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 (None (default) |Window | “hann” | “hamming” | “blackman”) – Window that is applied to the filter coefficients

  • normalize (bool, (defaultTrue)) – IfTrue, the filter is normalized to have unit power.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:
  • x ([…,N],tf.complex ortf.float) – Input to which the filter is applied along the last dimension

  • padding (“full” (default) | “valid” | “same”) – Padding mode for convolvingx and the filter

  • conjugate (bool, (defaultFalse)) – IfTrue, the complex conjugate of the filter is applied.

Output:

y ([…,M],tf.complex ortf.float) – Filtered input. The length M depends on thepadding.

propertyaclr

ACLR of the filter

This ACLR corresponds to what one would obtain from usingthis 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 normalizedfrequency.

tf.float : ACLR in linear scale

propertycoefficients

Set/get raw filter coefficients

Type:

[K],tf.float oftf.complex

propertylength

Filter length in samples

Type:

int

propertynormalize

IfTrue the filter is normalized to have unit power.

Type:

bool

propertysamples_per_symbol

Number of samples per symbol, i.e., the oversampling factor

Type:

int

propertysampling_times

Sampling times in multiples ofthe symbol duration

Type:

[K],numpy.float32

show(response='impulse',scale='lin')[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 sizeof 1024 is assumed which is obtained through zero padding ofthe filter coefficients in the time domain.

Input:
  • response (“impulse” (default) | “magnitude”) – Desired response type

  • scale (“lin” (default) | “db”) – y-scale of the magnitude response.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

propertyspan_in_symbols

Filter span in symbols

Type:

int

propertywindow

Get/set window function thatis applied to the filter coefficients

Type:

Window

Window functions

classsionna.phy.signal.HannWindow(normalize=False,precision=None,**kwargs)[source]

Block for defining a Hann window function

The window function is applied through element-wise multiplication.

The Hann window is defined by

\[w_n = \sin^2 \left( \frac{\pi n}{N} \right), 0 \leq n \leq N-1\]

where\(N\) is the window length.

Parameters:
  • normalize (bool, (defaultFalse)) – IfTrue, the window is normalized to have unit average powerper coefficient.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…, N],tf.complex ortf.float) – The input to which the window function is applied.The window function is applied along the last dimension.The length of the last dimensionN must be the sameas thelength of the window function.

Output:

y ([…,N],tf.complex ortf.float) – Output of the windowing operation

propertycoefficients

Set/get raw window coefficients(before normalization)

Type:

[N],tf.float

propertylength

Window length in number of samples

Type:

int

propertynormalize

IfTrue, the window is normalized to have unit averagepower per coefficient.

Type:

bool

show(samples_per_symbol,domain='time',scale='lin')

Plot the window in time or frequency domain

For the computation of the Fourier transform, a minimum DFT sizeof 1024 is assumed which is obtained through zero padding ofthe window coefficients in the time domain.

Input:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • domain (“time” (default) | “frequency”) – Desired domain

  • scale (“lin” (default) | “db”) – y-scale of the magnitude in the frequency domain.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

classsionna.phy.signal.HammingWindow(normalize=False,precision=None,**kwargs)[source]

Block for defining a Hamming window function

The window function is applied through element-wise multiplication.

The Hamming window is defined by

\[w_n = a_0 - (1-a_0) \cos \left( \frac{2 \pi n}{N} \right), 0 \leq n \leq N-1\]

where\(N\) is the window length and\(a_0 = \frac{25}{46}\).

Parameters:
  • normalize (bool, (defaultFalse)) – IfTrue, the window is normalized to have unit average powerper coefficient.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…, N],tf.complex ortf.float) – The input to which the window function is applied.The window function is applied along the last dimension.The length of the last dimensionN must be the sameas thelength of the window function.

Output:

y ([…,N],tf.complex ortf.float) – Output of the windowing operation

propertycoefficients

Set/get raw window coefficients(before normalization)

Type:

[N],tf.float

propertylength

Window length in number of samples

Type:

int

propertynormalize

IfTrue, the window is normalized to have unit averagepower per coefficient.

Type:

bool

show(samples_per_symbol,domain='time',scale='lin')

Plot the window in time or frequency domain

For the computation of the Fourier transform, a minimum DFT sizeof 1024 is assumed which is obtained through zero padding ofthe window coefficients in the time domain.

Input:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • domain (“time” (default) | “frequency”) – Desired domain

  • scale (“lin” (default) | “db”) – y-scale of the magnitude in the frequency domain.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

classsionna.phy.signal.BlackmanWindow(normalize=False,precision=None,**kwargs)[source]

Block for defining a Blackman window function

The window function is applied through element-wise multiplication.

The Blackman window is defined by

\[w_n = a_0 - a_1 \cos \left( \frac{2 \pi n}{N} \right) + a_2 \cos \left( \frac{4 \pi n}{N} \right), 0 \leq n \leq N-1\]

where\(N\) is the window length,\(a_0 = \frac{7938}{18608}\),\(a_1 = \frac{9240}{18608}\), and\(a_2 = \frac{1430}{18608}\).

Parameters:
  • normalize (bool, (defaultFalse)) – IfTrue, the window is normalized to have unit average powerper coefficient.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…, N],tf.complex ortf.float) – The input to which the window function is applied.The window function is applied along the last dimension.The length of the last dimensionN must be the sameas thelength of the window function.

Output:

y ([…,N],tf.complex ortf.float) – Output of the windowing operation

propertycoefficients

Set/get raw window coefficients(before normalization)

Type:

[N],tf.float

propertylength

Window length in number of samples

Type:

int

propertynormalize

IfTrue, the window is normalized to have unit averagepower per coefficient.

Type:

bool

show(samples_per_symbol,domain='time',scale='lin')

Plot the window in time or frequency domain

For the computation of the Fourier transform, a minimum DFT sizeof 1024 is assumed which is obtained through zero padding ofthe window coefficients in the time domain.

Input:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • domain (“time” (default) | “frequency”) – Desired domain

  • scale (“lin” (default) | “db”) – y-scale of the magnitude in the frequency domain.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

classsionna.phy.signal.CustomWindow(coefficients,normalize=False,precision=None,**kwargs)[source]

Block for defining custom window function

The window function is applied through element-wise multiplication.

Parameters:
  • coefficients ([N],tf.float) – Window coefficients

  • normalize (bool, (defaultFalse)) – IfTrue, the window is normalized to have unit average powerper coefficient.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…, N],tf.complex ortf.float) – Input to which the window function is applied.The window function is applied along the last dimension.The length of the last dimensionN must be the same as thelength of the window function.

Output:

y ([…,N],tf.complex ortf.float) – Output of the windowing operation

propertycoefficients

Set/get raw window coefficients(before normalization)

Type:

[N],tf.float

propertylength

Window length in number of samples

Type:

int

propertynormalize

IfTrue, the window is normalized to have unit averagepower per coefficient.

Type:

bool

show(samples_per_symbol,domain='time',scale='lin')

Plot the window in time or frequency domain

For the computation of the Fourier transform, a minimum DFT sizeof 1024 is assumed which is obtained through zero padding ofthe window coefficients in the time domain.

Input:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • domain (“time” (default) | “frequency”) – Desired domain

  • scale (“lin” (default) | “db”) – y-scale of the magnitude in the frequency domain.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

classsionna.phy.signal.Window(normalize=False,precision=None,**kwargs)[source]

Abtract class defining a window function

The window function is applied through element-wise multiplication.

The window function is real-valued, i.e., hastf.float asdtype.Thedtype of the output is the same as thedtype of the inputx to which the window function is applied.The window function and the input must have the same precision.

Parameters:
  • normalize (bool, (defaultFalse)) – IfTrue, the window is normalized to have unit average powerper coefficient.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…, N],tf.complex ortf.float) – The input to which the window function is applied.The window function is applied along the last dimension.The length of the last dimensionN must be the sameas thelength of the window function.

Output:

y ([…,N],tf.complex ortf.float) – Output of the windowing operation

propertycoefficients

Set/get raw window coefficients(before normalization)

Type:

[N],tf.float

propertylength

Window length in number of samples

Type:

int

propertynormalize

IfTrue, the window is normalized to have unit averagepower per coefficient.

Type:

bool

show(samples_per_symbol,domain='time',scale='lin')[source]

Plot the window in time or frequency domain

For the computation of the Fourier transform, a minimum DFT sizeof 1024 is assumed which is obtained through zero padding ofthe window coefficients in the time domain.

Input:
  • samples_per_symbol (int) – Number of samples per symbol, i.e., the oversampling factor

  • domain (“time” (default) | “frequency”) – Desired domain

  • scale (“lin” (default) | “db”) – y-scale of the magnitude in the frequency domain.Can be “lin” (i.e., linear) or “db” (, i.e., Decibel).

Utility Functions

sionna.phy.signal.convolve(inp,ker,padding='full',axis=-1,precision=None)[source]

Filters an inputinp of lengthN by convolving it with a kernelker of lengthK

The length of the kernelker must not be greater than the one of the input sequenceinp.

Thedtype of the output istf.float only if bothinp andker aretf.float. It istf.complex otherwise.inp andker must have the same precision.

Three padding modes are available:

  • “full” (default): Returns the convolution at each point of overlap betweenker andinp.The length of the output isN + K - 1. Zero-padding of the inputinp is performed tocompute the convolution at the border points.

  • “same”: Returns an output of the same length as the inputinp. The convolution is computed suchthat the coefficients of the inputinp are centered on the coefficient of the kernelker with index(K-1)/2 for kernels of odd length, andK/2-1 for kernels of even length.Zero-padding of the input signal is performed to compute the convolution at the border points.

  • “valid”: Returns the convolution only at points whereinp andker completely overlap.The length of the output isN - K + 1.

Input:
  • inp ([…,N],tf.complex ortf.float) – Input to filter

  • ker ([K],tf.complex ortf.float) – Kernel of the convolution

  • padding (“full” (default) | “valid” | “same”) – Padding mode

  • axis (int, (default -1)) – Axis along which to perform the convolution

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Output:

out ([…,M],tf.complex ortf.float) – Convolution output.The lengthM of the output depends on thepadding.

sionna.phy.signal.fft(tensor,axis=-1,precision=None)[source]

Computes the normalized DFT along a specified axis

This operation computes the normalized one-dimensional discrete Fouriertransform (DFT) along theaxis dimension of atensor.For a vector\(\mathbf{x}\in\mathbb{C}^N\), the DFT\(\mathbf{X}\in\mathbb{C}^N\) is computed as

\[X_m = \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1} x_n \exp \left\{ -j2\pi\frac{mn}{N}\right\},\quad m=0,\dots,N-1.\]
Input:
  • tensor (tf.complex) – Tensor of arbitrary shape

  • axis (int, (default -1)) – Dimension along which the DFT is taken

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Output:

tf.complex – Tensor of the same shape astensor

sionna.phy.signal.ifft(tensor,axis=-1,precision=None)[source]

Computes the normalized IDFT along a specified axis

This operation computes the normalized one-dimensional discrete inverseFourier transform (IDFT) along theaxis dimension of atensor.For a vector\(\mathbf{X}\in\mathbb{C}^N\), the IDFT\(\mathbf{x}\in\mathbb{C}^N\) is computed as

\[x_n = \frac{1}{\sqrt{N}}\sum_{m=0}^{N-1} X_m \exp \left\{ j2\pi\frac{mn}{N}\right\},\quad n=0,\dots,N-1.\]
Input:
  • tensor (tf.complex) – Tensor of arbitrary shape

  • axis (int, (default -1)) – Dimension along which the IDFT is taken

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Output:

tf.complex – Tensor of the same shape astensor

classsionna.phy.signal.Upsampling(samples_per_symbol,axis=-1,precision=None,**kwargs)[source]

Upsamples a tensor along a specified axis by inserting zerosbetween samples

Parameters:
  • samples_per_symbol (int) – Upsampling factor. Ifsamples_per_symbol is equal ton,then the upsampled axis will ben-times longer.

  • axis (int, (default -1)) – Dimension to be up-sampled. Must not be the first dimension.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…,n,…],tf.float ortf.complex) – Tensor to be upsampled.n is the size of theaxis dimension.

Output:

y ([…,n*samples_per_symbol,…],tf.float ortf.complex) – Upsampled tensor

classsionna.phy.signal.Downsampling(samples_per_symbol,offset=0,num_symbols=None,axis=-1,precision=None,**kwargs)[source]

Downsamples a tensor along a specified axis by retaining one out ofsamples_per_symbol elements

Parameters:
  • samples_per_symbol (int) – Downsampling factor. Ifsamples_per_symbol is equal ton, then thedownsampled axis will ben-times shorter.

  • offset (int, (default 0)) – Index of the first element to be retained

  • num_symbols (None (default) |int) – Total number of symbols to be retained after downsampling

  • axis (int, (default -1)) – Dimension to be downsampled. Must not be the first dimension.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Input:

x ([…,n,…],tf.float ortf.complex) – Tensor to be downsampled.n is the size of theaxis dimension.

Output:

y ([…,k,…],tf.float ortf.complex) – Downsampled tensor, wherekis min((n-offset)//samples_per_symbol,num_symbols).

sionna.phy.signal.empirical_psd(x,show=True,oversampling=1.0,ylim=(-30,3),precision=None)[source]

Computes the empirical power spectral density

Computes the empirical power spectral density (PSD) of tensorxalong the last dimension by averaging over all other dimensions.Note that this functionsimply returns the averaged absolute squared discrete Fourierspectrum ofx.

Input:
  • x ([…,N],tf.complex) – Signal of which to compute the PSD

  • show (bool, (defaultTrue)) – Indicates if a plot of the PSD should be generated

  • oversampling (float, (default 1)) – Oversampling factor

  • ylim ((float, float), (default (-30, 3))) – Limits of the y axis. Only relevant ifshow is True.

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Output:
  • freqs ([N],tf.float) – Normalized frequencies

  • psd ([N],tf.float) – PSD

sionna.phy.signal.empirical_aclr(x,oversampling=1.0,f_min=-0.5,f_max=0.5,precision=None)[source]

Computes the empirical ACLR

Computes the empirical adjacent channel leakgae ration (ACLR)of tensorx based on its empirical power spectral density (PSD)which is computed along the last dimension by averaging overall other dimensions.

It is assumed that the in-band ranges from [f_min,f_max] innormalized frequency. The ACLR is then defined as

\[\text{ACLR} = \frac{P_\text{out}}{P_\text{in}}\]

where\(P_\text{in}\) and\(P_\text{out}\) are the in-bandand out-of-band power, respectively.

Input:
  • x ([…,N],tf.complex) – Signal for which to compute the ACLR

  • oversampling (float, (default 1)) – Oversampling factor

  • f_min (float, (default -0.5)) – Lower border of the in-band in normalized frequency

  • f_max (float, (default 0.5)) – Upper border of the in-band in normalized frequency

  • precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,precision is used.

Output:

aclr (float) – ACLR in linear scale