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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 area of peaks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gatordan82

USA
7 Posts

Posted - 03/08/2011 :  8:14:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8 and Service Release 6:
Operating System: Windows XP (32 bit)

I am trying to find the peak intensity of two peaks in my data. I can use the pkfind function to locate the peak positions, but I need to integrate to find the area. I looked over another article in the Origin wiki

http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:X-Functions_for_Data_Analysis

This seems to be using functions (e.g. pkarea) that are maybe outdated in my version. Is there a convenient way to integrate the area under a peak? Ideally I'd like to be able to integrate from say x1 to x2, where f(x1) and f(x2) are some small percentage (~2%) of the peak height.

Any help would be appreciated.

Sam Fang

293 Posts

Posted - 03/09/2011 :  02:54:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use pkfind function to find the left and right base marker index for each peak. Then use integ1 to integrate and calculate the area.

You can see the Subtract Baseline and Integrate Peaks example in the page:
http://wiki.originlab.com/~originla/ltwiki/index.php?title=LabTalk:Peaks_and_Baseline#Subtract_Baseline_and_Integrate_Peaks

I test it and it can work in Origin8.0SR6.

Sam
OriginLab Technical Services

Edited by - Sam Fang on 03/11/2011 01:21:21 AM
Go to Top of Page

gatordan82

USA
7 Posts

Posted - 03/10/2011 :  12:19:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So I got this to work out pretty well for a single peak. My issue is that I have multiple peaks I need to integrate, so I have a new problem I guess.

I've tried restricting my code so that it searches for a peak in a range that I've set as a subset of my whole data that only does contain one peak. This works fine for finding the peak, and then the corresponding limits for the peak. But when I want to integrate this it's giving me an error about my input to the integ1 routine.

Does anybody know what my mistake might be, or a workaround?

range spectrum = col(2); //ydata
range xdata = col(1); //xdata

limit spectrum -b 200 -e 400; //restricted range with only 1 peak
g = limit.ymax; //finds peak height
gthresh = 0.02*g; //sets my footheight for the peak limits
range gpeak = spectrum[200:400]; //restricted range for y
range xgdata = xdata[200:400]; //restricted range for x
dataset gixl; //temp variables
dataset gixr;
pkfind iy:=gpeak fheight:=gthresh oleft:=gixl oright:=gixr; //find the one peak
range garea=gpeak[$(gixl):$(gixr)]; //x range over peak limits
range xgarea=xgdata[$(gixl):$(gixr)]; //y range over peak limits
integ1 iy:=garea; //integrate the area of the peak
gintens=integ1.area; //store the area of the peak

Go to Top of Page

Sam Fang

293 Posts

Posted - 03/11/2011 :  01:47:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It may results from that you can't define a range from a column subrange. e.g.

range garea=gpeak[$(gixl):$(gixr)]; //y range over peak limits
range xgarea=xgdata[$(gixl):$(gixr)]; //x range over peak limits


You can try the following:

range garea=spectrum[$(gixl+200-1):$(gixr+400-1)]; //y range over peak limits
range xgarea=xdata[$(gixl+200-1):$(gixr+400-1)]; //x range over peak limits

You can also use Origin's Peak Analyzer tool in the menu, which may be easier.

Sam
OriginLab Technical Services

Edited by - Sam Fang on 03/11/2011 01:56:27 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000