![]() To adapt the above code by using SciPy source, type: from scipy.signal import savgol_filter ![]() Fortunately, the Savitzky-Golay filter has been incorporated into the SciPy library, as pointed out by (thanks for the updated link). UPDATE: It has come to my attention that the cookbook example I linked to has been taken down. Yhat = savitzky_golay(y, 51, 3) # window size 51, polynomial order 3 Note: I left out the code for defining the savitzky_golay() function because you can literally copy/paste it from the cookbook example I linked above. ![]() See my code below to get an idea of how easy it is to use. It works great even with noisy samples from non-periodic and non-linear sources. This continues until every point has been optimally adjusted relative to its neighbors. Finally the window is shifted forward by one data point and the process repeats. 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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |