The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 peak finding/peak height

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
gatordan82 Posted - 11/23/2010 : 6:34:47 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0.63.988 SR6
Operating System: Windows XP

I have a bit of code that's supposed to find the peak values of a dataset at three different intervals in x. After a background removal I loop through each spectrum to find these peaks. The problem is that for one of the peaks, it is usually very small amplitude, and sometimes so small that it's in the noise level. I would like to get my code to find the peak value if it can (positive peak, not a trough) and output the amplitude, or if it can't find the peak, output the maximum y value over the specified x-range.

I've tried using the max function and limit function with not much success. A main problem is that if the pkfind function doesn't find a peak, it ends the script. Is there a way to do some kind of if/then structure for it the pkfind search fails go to finding the max value?

Here's the pertinent snippet from my code:

loop(jj, 2, n)
{
pkfind iy:=wcol(jj)[200:400] method:=first filter:=num value:=1 ocenter_x:=wcol(n+1) ocenter_y:=wcol(n+2);
pkfind iy:=wcol(jj)[950:1150] method:=first filter:=num value:=1 ocenter_x:=wcol(n+3) ocenter_y:=wcol(n+4);
pkfind iy:=wcol(jj)[80:140] dir:=p method:=first filter:=num value:=1 ocenter_x:=wcol(n+5) ocenter_y:=wcol(n+6); //This is the problem peak
ratio[jj] = wcol(n+4)[1]/wcol(n+2)[1];
dratio[jj] = wcol(n+6)[1];
wks.ncols = n;
}
2   L A T E S T    R E P L I E S    (Newest First)
Laurie Posted - 12/06/2010 : 5:35:38 PM
Also, please check out the following link:

http://www.originlab.com/www/helponline/Origin/en/programming/mergedProjects/LabTalk/LabTalk/X-Function_Exception_Handling.html

OriginLab Technical Support
Sam Fang Posted - 11/23/2010 : 10:48:40 PM
You can use a brace "{}" to enclose the script. Then if it doesn't find a peak, it will continue and not end the script.
---------------------------------------
{pkfind iy:=wcol(jj)[80:140] dir:=p method:=first filter:=num value:=1 ocenter_x:=wcol(n+5) ocenter_y:=wcol(n+6);} //This is the problem peak

---------------------------------------

Sam
OriginLab Technical Services

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000