filter#

Filter functions for matched filtering, pulse-shaping and impairment simulation.

qampy.core.filter.filter_signal(signal, fs, cutoff, ftype='bessel', order=2, analog=False)#

Apply an analog filter to a signal for simulating e.g. electrical bandwidth limitation

Parameters:
  • signal (array_like) – input signal array

  • fs (float) – sampling frequency of the input signal

  • cutoff (float) – 3 dB cutoff frequency of the filter

  • ftype (string, optional) – filter type can be either a bessel, butter, exp or gauss filter (default=bessel)

  • order (int) – order of the filter

Returns:

signalout – filtered output signal

Return type:

array_like

qampy.core.filter.moving_average(sig, N=3)#

Moving average of signal

Parameters:
  • sig (array_like) – Signal for moving average

  • N (number of averaging samples) –

Returns:

mvg – Average signal of length len(sig)-n+1

Return type:

array_like

qampy.core.filter.pre_filter(signal, bw)#

Low-pass pre-filter signal with square shape filter

Parameters:
  • signal (array_like) – single polarization signal

  • bw (float) – bandwidth of the rejected part, given as fraction of overall length

qampy.core.filter.pre_filter_wdm(signal, bw, os, center_freq=0)#

Ideal LP filter for selecting part of the spectrum. Uses FFT

Parameters:
  • signal (array-like) – Input signal

  • bw (float) – Filter bandwidth, normalized units

  • os (float) – Oversampling factor

  • center_freq (float) – center frequency, normalized units. Default is DC centered operation

Returns:

s – Output signal after filtering

Return type:

array-like

qampy.core.filter.rrcos_pulseshaping(sig, fs, T, beta, taps=1001)#

Root-raised cosine filter applied in the time domain using fftconvolve.

Parameters:
  • sig (array_like) – input time distribution of the signal

  • fs (float) – sampling frequency of the signal

  • T (float) – width of the filter (typically this is the symbol period)

  • beta (float) – filter roll-off factor needs to be in range [0, 1]

  • taps (int, optional) – number of filter taps (if None do a spectral domain filter)

Returns:

sign_out – filtered signal in time domain

Return type:

array_like