python - Finding only the "prominent" local maxima of a 1d array -


i have couple of data sets clusters of peaks following: data sets clusters of peaks can see main features here clusters of peaks, each cluster having 3 peaks. find x values of local peaks, running few problems. current code follows:

import numpy np import matplotlib.pyplot plt scipy import loadtxt, optimize scipy.signal import argrelmax  def rounddown(x):     return int(np.floor(x / 10.0)) * 10  pixel, value = loadtxt('voltage152_4.txt', unpack=true, skiprows=0)  ax = plt.axes() ax.plot(pixel, value, '-') ax.axis([0, np.max(pixel), np.min(value), np.max(value) + 1])  maxtemp = argrelmax(value, order=5) maxes = [] maxi in maxtemp[0]:     if value[maxi] > 40:         maxes.append(maxi)  ax.plot(maxes, value[maxes], 'ro')  plt.yticks(np.arange(rounddown(value.min()), value.max(), 10)) plt.savefig("spectrum1.pdf") plt.show() 

which works relatively well, still isn't perfect. peaks labeled: some peaks labeled main problem here signal isn't smooth, few things aren't relevant peaks getting picked up. can see in stray maxima halfway down cluster, peaks have 2 maxima in reality should one. can see near center of plot there high frequency maxima. picking added in loop considering values above point.

i afraid smoothing curve make me loose of clustered peaks want, in of other datasets there closer together. maybe fears unfounded, though, , misunderstanding how smoothing works. appreciated.

does have solution on how pick out "prominent" peaks? is, peaks quick large compared others?


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -