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
 Any way to find peaks not on graph basis?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

adamleewiner

China
Posts

Posted - 07/30/2008 :  6:11:28 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
How to find peaks from datasets or columes rather than from a graph, I mean the input data is from a workbook without a graph existing.

An USTCer always keep trying.

Deanna

China
Posts

Posted - 07/30/2008 :  11:53:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

If you are using Orign SR2 (the latest patch), you can use the pkfind X-Function to find peaks from datasets/columns/ranges. Below is an example of importing spectrum data and finding peaks in it.


//Import spectrum data with 7 peaks
string fname$=system.path.program$ + "Samples\Spectroscopy\HiddenPeaks.dat";
newbook sheet:=0;
newsheet cols:=5 labels:="Time|Spectrum Data|Peak Center Indices|Peak Center X|Peak Center Y";
impASC;
string bkn$=%H;

//Find peak centers
pkFind iy:=col(2) method:=second ocenter:=col(3) oleft:=<none> oright:=<none> ;

//Find peak center positions by their indeces
col(4)=col(1)[col(3)];	//X positions
col(5)=col(2)[col(3)];	//Y positions

//Plot spetrum data as a black line
plotxy iy:=col(2) plot:=200;

//Plot peak centers as red scatters
plotxy iy:=[bkn$]1!(4,5) plot:=201  legend:=1 color:=2 ogl:=1!;


Deanna
OriginLab Technical Services
Go to Top of Page

adamleewiner

China
Posts

Posted - 07/31/2008 :  07:59:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for you reply, Deanna.
However, I think I have to first plot a graph and then pkfind to get what I want. Origin is becoming more and more powerful.
quote:
Originally posted by Deanna

Hi,

If you are using Orign SR2 (the latest patch), you can use the pkfind X-Function to find peaks from datasets/columns/ranges. Below is an example of importing spectrum data and finding peaks in it.


//Import spectrum data with 7 peaks
string fname$=system.path.program$ + "Samples\Spectroscopy\HiddenPeaks.dat";
newbook sheet:=0;
newsheet cols:=5 labels:="Time|Spectrum Data|Peak Center Indices|Peak Center X|Peak Center Y";
impASC;
string bkn$=%H;

//Find peak centers
pkFind iy:=col(2) method:=second ocenter:=col(3) oleft:=<none> oright:=<none> ;

//Find peak center positions by their indeces
col(4)=col(1)[col(3)];	//X positions
col(5)=col(2)[col(3)];	//Y positions

//Plot spetrum data as a black line
plotxy iy:=col(2) plot:=200;

//Plot peak centers as red scatters
plotxy iy:=[bkn$]1!(4,5) plot:=201  legend:=1 color:=2 ogl:=1!;


Deanna
OriginLab Technical Services



An USTCer always keep trying.
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