I have a signal that looks like the blue one, and I want to obtain the red one, while knowing there are exactly 2 minimums within the range (0, 255)
.
To obtain the red signal, I have done
@staticmethod
def _smooth_curve(curve, kernel_size=5):
kernel = np.ones((kernel_size,)) / kernel_size
smooth = np.convolve(curve, kernel, mode='same')
return smooth
sig= self._smooth_curve(sig, 20)
sig= self._smooth_curve(sig, 14)
sig= self._smooth_curve(sig, 10)
sig= self._smooth_curve(sig, 6)
This is far from robust.
I want to make sure I get 2 minimums, and that they come out between the 3 peaks.
The peaks are not necessarily at the shown amplitudes, but they are separable, meaning they don't overlap in a way that finding minima makes no sense.