使用直方图数据的概率密度函数
Probability density function using histogram data
我使用 Matplotlib 绘制 numpy.ndarray
(长度 1400)。我想检测 "peaks" 并创建一个函数,使其在 "not a peak" 时为 0.1,在峰值时为峰值的 y 值。
示例图表:
对您的数据应用DetectPeaks。计算二阶导数并决定您的 mpd、mph 设置。
first_derivative = np.gradient(data)
second_derivative = np.gradient(first_derivative)
ind = detect_peaks(second_derivative, mpd=20,mph=0, show=True)
print(ind)
然后用 0 或最大值填充数组---
arr = []
for i in range(0,len(n_test)):
for j in ind:
if i == j:
arr.append(n_test[i])
arr.append(0)
plt.plot(arr)
最后,检查其他峰值检测选项 -- peak detection overview
我使用 Matplotlib 绘制 numpy.ndarray
(长度 1400)。我想检测 "peaks" 并创建一个函数,使其在 "not a peak" 时为 0.1,在峰值时为峰值的 y 值。
示例图表:
对您的数据应用DetectPeaks。计算二阶导数并决定您的 mpd、mph 设置。
first_derivative = np.gradient(data)
second_derivative = np.gradient(first_derivative)
ind = detect_peaks(second_derivative, mpd=20,mph=0, show=True)
print(ind)
然后用 0 或最大值填充数组---
arr = []
for i in range(0,len(n_test)):
for j in ind:
if i == j:
arr.append(n_test[i])
arr.append(0)
plt.plot(arr)
最后,检查其他峰值检测选项 -- peak detection overview