1

I have two arrays MSFx and MSFy both of length 64, that plots out a graph with 7 clearly detectable peaks. However, only 4-5 get detected.

What I have so far.

MSFxr = np.array(MSFx[::-1])
MSFy = np.array(MSFy)
print(MSFxr)
print(MSFy)

indexes = peakutils.indexes(MSFy, thres=0.5, min_dist=2)
print(indexes)
print(MSFxr[indexes], MSFy[indexes])
pyplot.figure(figsize=(10, 6))
pplot(MSFxr, MSFy, indexes)
pyplot.title('First estimate')
pyplot.show()

MSFx looks like:

[ 218.75 437.5 656.25 875. 1093.75 1312.5 1531.25 1750. 1968.75 2187.5 2406.25 2625. 2843.75 3062.5 3281.25 3500. 3718.75 3937.5 4156.25 4375. 4593.75 4812.5 5031.25 5250. 5468.75 5687.5 5906.25 6125. 6343.75 6562.5 6781.25 7000. 7218.75 7437.5 7656.25 7875. 8093.75 8312.5 8531.25 8750. 8968.75 9187.5 9406.25 9625. 9843.75 10062.5 10281.25 10500. 10718.75 10937.5 11156.25 11375. 11593.75 11812.5 12031.25 12250. 12468.75 12687.5 12906.25 13125. 13343.75 13562.5 13781.25 14000. ]

MSFy looks like:

[ 57. 88. 110. 327. 1287. 236. 158. 137. 320. 1076. 241. 143. 108. 123. 286. 902. 204. 115. 116. 146. 205. 569. 1047. 234. 122. 103. 122. 154. 242. 600. 505. 176. 103. 81. 78. 82. 105. 131. 247. 456. 322. 213. 122. 89. 77. 73. 71. 73. 77. 87. 104. 131. 170. 228. 260. 302. 391. 488. 568. 606. 597. 555. 528. 521.]

I get the output:

[ 4 9 15 22] [ 1093.75 2187.5 3500. 5031.25] [ 1287. 1076. 902. 1047.]

And the plot produced:

Plot with detected peaks

I've been having a headache try to figure this out, if anyone has a possible solution it would help me greatly!

anquegi
  • 11,125
  • 4
  • 51
  • 67
  • 1
    According to https://pythonhosted.org/PeakUtils/reference.html#peakutils.peak.indexes the thresh is normalized, I bet those 3 un-found peaks are too small to show up. Try playing with that input? – tacaswell Nov 08 '16 at 05:35
  • Hey, thanks that helped me out, after changing the threshold it was able to find all of the peaks. Do you how it the threshold works exactly though? How does the thresh value scale to my values in the array? – DukeOfDoors Nov 08 '16 at 15:40

0 Answers0