The ability to distinguish labels from true peaks implies that you have a fundamental distance between the vertices. In other words, there is a minimum frequency resolution at which you want to run a peak detection search. If you are approaching a signal that is already drier than half the noise, you will see zigzag gags that appear “peaks” every few samples.
It looks like you want to do the following:
- Smooth the signal.
- Find the "real" peaks.
Or rather
- Run the signal through the low pass filter.
- /.
1:
1, , scipy.
, , FIR- scipy.
from numpy import cos, sin, pi, absolute, arange, arange
from scipy.signal import kaiserord, lfilter, firwin, freqz, find_peaks_cwt
from pylab import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show, scatter
sample_rate = 100.0
nsamples = 400
t = arange(nsamples) / sample_rate
wave = cos(2*pi*0.5*t) + 0.2*sin(2*pi*2.5*t+0.1) + \
0.2*sin(2*pi*15.3*t) + 0.1*sin(2*pi*16.7*t + 0.1) + \
0.1*sin(2*pi*23.45*t+.8)
nyq_rate = sample_rate / 2.0
width = 5.0/nyq_rate
ripple_db = 60.0
N, beta = kaiserord(ripple_db, width)
cutoff_hz = 10.0
taps = firwin(N, cutoff_hz/nyq_rate, window=('kaiser', beta))
filtered_x = lfilter(taps, 1.0, wave)

2:
2 , scipy. , . -.
figure(4)
plot(t[N-1:]-delay, filtered_x[N-1:], 'g', linewidth=1)
peakind = find_peaks_cwt(filtered_x, arange(3,20))
scatter([t[i] - delay for i in peakind], [filtered_x[i] for i in peakind], color="red")
for i in peakind:
print t[i] + delay
xlabel('t')
grid(True)
show()
