About FindPeak
LE1202
I'm trying to use FindPeak to find the first positive peak of my data, but it return me a negative value, which is even a peak value, that really make me confuse.
Attached file "test.txt" is my data.
Macro as following :
Macro test()
LoadWave/E=0/D/G/A/P=test "test.txt"
FindPeak wave1
EndMacro
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
Read the documentation carefully:
DisplayHelpTopic "FindPeak"
Here FindPeak returns a minimum. Maybe you want:
FindPeak/M=0 wave1
to define a "peak" to be something larger than 0.
August 7, 2018 at 03:18 am - Permalink
In reply to Read the documentation… by ChrLie
Thanks for your reply.
Attached file is my full data, while I use "FindPeak", only wave14 and wave33 return negative peak, but take wave0 as example, first peak isn't it should be minimum at row 4 or 5 for value -2.66 ?
August 7, 2018 at 08:17 am - Permalink
FindPeak finds maxima unless you use the /N flag.
I loaded your second file into Igor 8 and then used FindPeak on several of the waves:
V_Flag= 0; V_PeakLoc= 381; V_PeakVal= 3.102;
V_LeadingEdgeLoc= 379; V_TrailingEdgeLoc= 383; V_PeakWidth= 4;
•FindPeak wave1
V_Flag= 0; V_PeakLoc= 377; V_PeakVal= 2.78;
V_LeadingEdgeLoc= 372; V_TrailingEdgeLoc= 380; V_PeakWidth= 8;
•FindPeak wave33
V_Flag= 0; V_PeakLoc= 359; V_PeakVal= 3.048;
V_LeadingEdgeLoc= 353.5; V_TrailingEdgeLoc= 360;
V_PeakWidth= 6.5;
•FindPeak wave0
V_Flag= 0; V_PeakLoc= 377.5; V_PeakVal= 2.812;
V_LeadingEdgeLoc= 376; V_TrailingEdgeLoc= 378.667;
V_PeakWidth= 2.66667;
These all have found the obvious first positive peak.
August 7, 2018 at 09:38 am - Permalink
In reply to FindPeak finds maxima unless… by johnweeks
Thanks for your reply.
I think I make some mistake while typing the wave name
Following is what I got with FinkPeak by Igor Pro 6.22A
August 7, 2018 at 05:39 pm - Permalink
It seems like a small 'drop in intensity', so to speak, at the beginning of this particular data confuses FindPeak (which looks in the derivate data). The solution here is to increase the box size for the sliding average or flat-out define a minimum level which needs to be crossed for a peak:
V_Flag= 0; V_PeakLoc= 368; V_PeakVal= 2.858;
V_LeadingEdgeLoc= 364; V_TrailingEdgeLoc= 374; V_PeakWidth= 10;
•FindPeak/B=2 wave13
V_Flag= 0; V_PeakLoc= 368.5; V_PeakVal= 2.858;
V_LeadingEdgeLoc= 365; V_TrailingEdgeLoc= 446; V_PeakWidth= 81;
•FindPeak/M=0 wave32
V_Flag= 0; V_PeakLoc= 358; V_PeakVal= 2.978;
V_LeadingEdgeLoc= 355; V_TrailingEdgeLoc= 358.5; V_PeakWidth= 3.5;
•FindPeak/B=2 wave32
V_Flag= 0; V_PeakLoc= 360; V_PeakVal= 2.979;
V_LeadingEdgeLoc= 315; V_TrailingEdgeLoc= 375; V_PeakWidth= 60;
I don't know why, but these two approaches give slightly different results. See what works best for you.
August 7, 2018 at 10:16 pm - Permalink
In reply to Thanks for your reply. I… by LE1202
Using Igor 6.37 i get the same result you get. I guess things have been improved over the last 2 1/2 years! You can get the same result I got if you upgrade.
August 8, 2018 at 09:51 am - Permalink
In reply to Using Igor 6.37 i get the… by johnweeks
I got it thanks for everything.
August 8, 2018 at 05:53 pm - Permalink
For people coming to this topic later, I'd like to note that nearly all data has noise that needs smoothing out before FindPeak's simple derivative algorithm works well.
That means either use FindPeaks on data you have already smoothed, or always use the /B=boxPointsToSmooth flag.
And /M=minLevel (thresholding) is usually a good idea.
These ideas are used in the simple automatic peak-finder implemented in the procedure file:
#include <Peak AutoFind>
August 9, 2018 at 08:13 am - Permalink