Reputation: 6937
I have the following signal to process (raw data):
I would like to process the signal to eliminate outliers to obtain a "smooth" curve. Note: I do not want to change any of the actual values, I am only interested in removing spurious points. A specific requirement is that the curve "wraps around" (i.e. the beginning of the curve should be contiguous with its end). A picture may be more helpful (I have manually traced the black line to illustrate):
So far, I have tried thresholding the function based on a distance from a moving average, but that failed pretty miserably. I have also tried computing the first derivative and thresholding based on that, which was also unhelpful. Any ideas as to how I can achieve the desired result? I remain convinced there is a relatively simple solution that I am missing here. I am using Python/NumPy/SciPy.
Upvotes: 5
Views: 9236
Reputation: 77424
Use a rolling median filter from SciPy: < http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.filters.median_filter.html >.
You could also use other forms of a rolling average or rolling order statistic filter.
Upvotes: 6