If needed, you can find my first post for this problem here. I am trying to clean the following signal:
As proposed in the comment, I tried to use this post proposing 2 methods: median filtering and total variation denoising. I'm a python user, and I didn't find a good implementation of the second, thus I only kept the median filtering, implemented with scipy
.
from scipy.ndimage import median_filter
window_size = 10
data_filtered = median_filter(data, size=window_size, mode='nearest')
The result is, at first look, not too bad:
However, the ramp is not completely preserved. The first one is slightly shifted to the right; while the second remains at the correct position. If I zoom on the low amplitude signal, I get:
My goal is to measure the width of the square. This is directly impacting my measure. What is causing this phenomenon, why is it not symmetric and can it be fixed?
N.B: This is impacting my measure because I would like to measure the width at a us scale. Obviously, as those first measurements were done with a sampling frequency fs = 1e6
, this resolution is not possible. Would this problem be solved if I increase the sampling frequency? (Max is 1e9
). Which sampling frequency would you recommend?
Thank you for the guidance, Mathieu