曲线平滑
Savitzky-Golay滤波器
详解:
It uses least squares to regress a small window of your data onto a polynomial, then uses the polynomial to estimate the point in the center of the window. Finally the window is shifted forward by one data point and the process repeats. This continues until every point has been optimally adjusted relative to its neighbors.
FFT滤波器
Gaussian Filter
Kalman Filter
移动平均法(邻域平均值滤波器)
One simple form of moving average is to calculate the average of adjacent measurements at a certain position. In a one-dimensional series of measurements a[1:N], for example, the moving average at a[n] can be calculated as a[n] = (a[n-1] + a[n] + a[n+1]) / 3, for example. If you go through all of your measurements, you're done. In this simple example, our averaging window has size 3. You can also use windows of different sizes, depending on how much smoothing you want
Use an algorithm based on to make the calculation easier. The advantage of using convolution is that you can choose different kinds of averages, like weighted averages, by simply changing the window.
from scipy.signal import convolve# if z is 1d array, m is the window shape(moving average num)z1 = convolve(z, np.ones(m))