-
Signal Resampling (downsampling / upsampling)Data 2021. 4. 27. 11:35
The most popular/common functions are:
from scipy import signal x = np.linspace(0, 10, 20, endpoint=False) y = np.cos(-x**2/6.0) f_fft = signal.resample(y, 100) f_poly = signal.resample_poly(y, 100, 20, padtype='line') # same as "signal.resample_poly(y, 5, 1, padtype='line')" xnew = np.linspace(0, 10, 100, endpoint=False) import matplotlib.pyplot as plt plt.figure(figsize=(10, 4)) plt.plot(xnew, f_fft, 'b.-', xnew, f_poly, 'r.-') plt.plot(x, y, 'ko-') plt.plot(10, y[0], 'bo', 10, 0., 'ro') # boundaries plt.legend(['resample', 'resamp_poly', 'data'], loc='best') plt.tight_layout() plt.show()
References
'Data' 카테고리의 다른 글
PyPI registration (0) 2022.08.17 Automatically create requirements.txt (0) 2022.03.02 YAML Tutorial Quick Start (0) 2021.08.04