曲线平滑
Savitzky-Golay滤波器
Python Scipy Signal Library ---- savgol_filter
详解: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
https://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matplotlib
Kalman Filter
移动平均法(邻域平均值滤波器)
http://en.wikipedia.org/wiki/Moving_average
https://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matplotlib
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 convolution 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))