07-20-2009 08:23 AM
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 🙂
07-20-2009 08:45 AM
07-20-2009 07:08 PM
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
07-21-2009 02:00 AM
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.
07-21-2009 09:18 AM
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
07-22-2009 12:53 AM
Hi Brad
I attached the data I work with in first post.
I hope it helps 🙂
07-22-2009 05:12 AM
07-22-2009 11:40 AM
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
07-23-2009 01:23 AM
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 🙂