DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to mark selective peaks ?

How can I mark selective peaks on a chart ?

 

I attached example picture how it supose to  look, but at this point  I can only mark one peak (code used below).

 

 

Option Explicit 'Forces the explicit declaration of all the variables in a script. Call CHNCALCULATE("Ch(""[1]/Result"") = Ch(""[1]/Torque"")+CTNV(Ch(""[1]/Torque"")<2)") Call Data.Root.ChannelGroups(1).Channels.Add("Channel1",DataTypeFloat64,4) Call Data.Root.ChannelGroups(1).Channels.Add("Channel2",DataTypeFloat64,5) Call DataBlClpCopy("[1]/Angle",11257,644) '... ChnNoStr,ChnRow,ValNo Call DataBlClpPaste("[1]/Channel1",1,0) '... ChnNoStr,ChnRow,ValNo Call DataBlClpCopy("[1]/Result",11257,644) '... ChnNoStr,ChnRow,ValNo Call DataBlClpPaste("[1]/Channel2",1,0) '... ChnNoStr,ChnRow,ValNo Call Data.Root.ChannelGroups(1).Channels(4).Name = "Result_X" Call Data.Root.ChannelGroups(1).Channels(5).Name = "Result_Y" Call ChnPeakFind("[1]/Result_X","[1]/Result_Y","/PeakX","/PeakY",1,"Max.Peaks","Amplitude") '... XW,Y,E,E,PeakNo,PeakType,PeakSort

 

I use Diadem 11. 

Example data channels and report layout in attachment.

 

Any help appreciated 🙂

 

 

 

Download All
0 Kudos
Message 1 of 9
(5,361 Views)
Hi Domin,

If I understand you right you get only one peak but want to find more. Without going into the details it looks like you just have to adjust the 5th parameter of ChnPeakFind. You specified "1" and should input the number of peaks you want to find instead.

Hope that helps,
Ralf
0 Kudos
Message 2 of 9
(5,354 Views)

Hello Domin,

 

Check the DIAdem Examples for an example called "Searching for Outliers with the Peak Search Function"- that seems to do what you are looking to do.

 

    Otmar

 
Otmar D. Foehner
0 Kudos
Message 3 of 9
(5,343 Views)

Hi guys !

 

Thanks for replies.

 

Unfortunately none of your advices worked for me 😞

 

When I change no. of peaks to 5 for example, I get peaks marked only in one period (all 5).

 

I also tried to adapt example mentioned above but I get error "Channel is not monotonic" and only 1 period is marked.

 

I was wondering, maybe the solution is to copy each period to a new channel and then mark peaks ? But the problem is don't know how to do this. The second problem is that I will have many charts and they will differ.

 

 

 

0 Kudos
Message 4 of 9
(5,335 Views)

Hi Domin,

 

Peak detection is more complicated than we usually give it credit for, and human eyes are much better at it than computer programs.

 

Would you be able to send over the data set that you're wanting to detect peaks in, the one where the 5 peaks DIAdem detects are all in the first period, instead of spread over the whole data set?  I tried running the VBScript you posted, but I didn't have an "Angle" channel for it to work with.

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 5 of 9
(5,319 Views)

Hi Brad

 

I attached the data  I work with in first post.

 

I hope it helps 🙂

0 Kudos
Message 6 of 9
(5,310 Views)
Hi Domin,

your question why you get the first five (very local) peaks in your data instead of the five global peaks is easy to resolve. If you have a look at the syntax of Call ChnPeakFind(XW, Y, E, E, PeakNo, PeakType, PeakSort) just set the parameter PeakSort to "Amplitude". Then ChnPeakFind will return the five global peaks in your data set.

But if you now follow this approach and search for 32 global peaks in your data set you won't get the values your marked (manually) in your graphic, because some of the secondary peaks nearby primary peaks are higher than some other primary peaks. And I think any program coming out of the box can't do more than giving you the global peaks in your data. (As Brad put it the human eye or brain is hard to emulate in this case.)

Thus you have to cut your data into slices or chunks of approx 20 degrees in the example given and search for one global maximum in each chunk. Hopefully you can tell in advance how many peaks you are going to look for, i.e. how big the chunks have to be to contain exactly one peak.

Regards,
Ralf
0 Kudos
Message 7 of 9
(5,302 Views)

Hi Domin,

 

After some non-trival adaptation, I was able to get an example of mine to work for your data.  The unusual thing about your data is that the center line of the oscillations shifts from positive to negative depending on whether the angle is increasing or decreasing.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Download All
Message 8 of 9
(5,287 Views)

Hi Brad

 

Your script is great ! I will have to tune it a little but it helps me a lot.

 

Thank you for your support 🙂

0 Kudos
Message 9 of 9
(5,269 Views)