resample#

Signal resampling functions with different filter methods

qampy.core.resample.resample_poly(signal, fold, fnew, window=None, renormalise=False)#

Resamples a signal from an old frequency to a new. Preserves the whole data but adjusts the length of the array in the process.

Parameters:
  • signal (array_like) – signal to be resampled

  • fold (float) – Sampling frequency of the signal

  • fnew (float) – New desired sampling frequency.

  • window (array_like, optional) – sampling windowing function

  • renormalise (bool, optional) – whether to renormalise and recenter the signal to a power of 1.

Returns:

out – resampled signal of length fnew/fold*len(signal)

Return type:

array_like

qampy.core.resample.rrcos_resample(signal, fold, fnew, Ts=None, beta=None, taps=4001, renormalise=False, fftconv=True)#

Resample a signal using a root raised cosine filter. This performs pulse shaping and resampling a the same time. The resampling is done by scipy.signal.resample_poly. This function can be quite slow.

Parameters:
  • signal (array_like) – input time domain signal

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

  • fnew (float) – desired sampling frequency

  • Ts (float, optional) – time width of the RRCOS filter (default:None makes this 1/fold)

  • beta (float, optional) – filter roll off factor between (0,1] (default:None will use the default filter in poly_resample)

  • taps (int, optional) – taps of the interpolation filter if taps is None we filter by zeroinsertion upsampling and multipling with the full length rrcos frequency response in the spectral domain

  • fftconv (bool, optional) – filter using zero insertion upsampling/decimation and filtering using fftconvolve. I often faster for long filters and power of two signal lengths.

Returns:

sig_out – resampled output signal

Return type:

array_like