Если подходящая гауссовская подгонка была бы подходящей, вы могли бы взять количество найденных пиков и поместить n гауссовых распределений (1 для каждого пика) плюс постоянную переменную для фонового шума (или вы могли бы добавить еще один гауссовский к кривая подходит
import numpy as np
from scipy.optimize import curve_fit
from scipy.signal import find_peaks_cwt
from math import *
peak_indices = find_peaks_cwt(data, *args)
#make a fitting function that takes x number of peak widths
def makeFunction(indices, data):
def fitFunction(x, *args):
#sum of gaussian functions with centers at peak_indices and heights at data[peak_indices] plus a constant for background noise (args[-1])
return sum([data[indices[i]]*exp(-((x-indices[i])**2)/(2*args[i]**2)) for i in range(len(peak_indices))])+args[-1] #does my code golfing show? xD
return fitFunction
f = makeFunction(peak_indices, data)
#you must provide the initial guess of "np.ones(len(peak_indices)+1)" for the parameters, because f(x, *args) will otherwise take a variable number of arguments.
popt, pcov = curve_fit(f, np.arange(len(data)), data, np.ones(len(peak_indices)+1))
#standard deviations (widths) of each gaussian peak and the average of the background noise
stdevs, background = popt[:-1], popt[-1]
#covariance of result variables
stdevcov, bgcov = pcov[:-1], pcov[-1]
Это должно дать вам место, чтобы начать, но вы, вероятно, придется изменить функцию оптимизации для работы с данными (или, возможно, будет работать вообще, я не проверял)
подходит ли гауссово распределение? – Aaron