Hello everyone,
I searched long time on this matter I couldn't figure out a reliable way to proceed.
I have a signal for example attached file.
The black curve is the original signal, I want to convert it to something similar to the red signal ?
Then I would add a parameter to define the minimum "averaging length" i believe.
I am surprise that there is no such function already defined. If you have any suggestion there are welcome.
Thanks in advance.
@
Gribouillis : thank you for your response, but I couldn't figure out how this function could do what I need.
Can you describe what the image is supposed to mean? Why are the red lines drawn where they are? Why aren't there a series of steps in the big peak? Why is the red line drawn where it is in the peak? Why are there 2 read lines right of the peak instead of 1?
Gribouillis might be onto something. Bin the data and then use some heuristic to combine bins until all bins are wider than some minimum width. May be as simple as:
while minimum width bin < minimum allowable bin:
combine two most similar adjacent bins
@
deanhystad thanks for your contribution.
The red lines are supposed to represent the "average" level of the signal for different phases.
A phase should last a minimum dx (the minimum allowable bin), then I believe I should add a parameter to define the min dy from bin to bin to consider a new phase.
For example in attached figure, for the time being I used np.digitize to get the orange curve, then 2 loops to get the number of phases and then filter number of phases not long enough (in green). Still I believe I need to add a temporary variable to create a new phase if several sucessive bins are smaller than the minimum bin (so the last part should be counted as a separate phase). Then once I have all phases, I will take the average of it.
This is a bit DIY, I expected to have such function ready in python libraries...