scipy.signal.resample(x, num, t=None, axis=0, window=None)

Resample to num samples using Fourier method along the given axis.

The resampled signal starts at the same value of x but is sampled with a spacing of len(x) / num * (spacing of x). Because a Fourier method is used, the signal is assumed periodic.

Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to alleviate ringing in the resampled values for sampled signals you didn’t intend to be interpreted as band-limited.

If window is a function, then it is called with a vector of inputs indicating the frequency bins (i.e. fftfreq(x.shape[axis]) )

If window is an array of the same length as x.shape[axis] it is assumed to be the window to be applied directly in the Fourier domain (with dc and low-frequency first).

If window is a string then use the named window. If window is a float, then it represents a value of beta for a kaiser window. If window is a tuple, then the first component is a string representing the window, and the next arguments are parameters for that window.

Possible windows are:
‘flattop’ – ‘flat’, ‘flt’ ‘boxcar’ – ‘ones’, ‘box’ ‘triang’ – ‘traing’, ‘tri’ ‘parzen’ – ‘parz’, ‘par’ ‘bohman’ – ‘bman’, ‘bmn’ ‘blackmanharris’ – ‘blackharr’, ‘bkh’ ‘nuttall’, – ‘nutl’, ‘nut’ ‘barthann’ – ‘brthan’, ‘bth’ ‘blackman’ – ‘black’, ‘blk’ ‘hamming’ – ‘hamm’, ‘ham’ ‘bartlett’ – ‘bart’, ‘brt’ ‘hanning’ – ‘hann’, ‘han’ (‘kaiser’, beta) – ‘ksr’ (‘gaussian’, std) – ‘gauss’, ‘gss’ (‘general gauss’, power, width) – ‘general’, ‘ggs’ (‘slepian’, width) – ‘slep’, ‘optimal’, ‘dss’

The first sample of the returned vector is the same as the first sample of the input vector, the spacing between samples is changed from dx to

dx * len(x) / num

If t is not None, then it represents the old sample positions, and the new sample positions will be returned as well as the new samples.

Previous topic


Next topic


This Page