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
 pkrect is gone
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

marrotx

Germany
Posts

Posted - 09/10/2008 :  09:39:15 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear OriginLab-Team,

I had written a script in LabTalk using the pkrect-function.

pkrect iy:=[graph1]layer1!plot(1) option:=p rectw:=50 recth:=30;

After updating my origin from version OriginPro 8G SR2 v8.07?? to v.8.0891, my script can't find the pkrect command anymore. I haven't found any comments on renewed commands yet. Unfortunately, every attempt to use other functions were not succesful.
Even the wiki and help files don't contain any information on that.

Can you please give me information on where to find "pkrect" or how to use new functions to get the same result?

Best regards,
marrotx

Echo_Chu

China
Posts

Posted - 09/11/2008 :  01:22:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Marrotx,

Sorry that we have remove pkrect from SR3. The x-function is old and we did not thought of someone is using it...

However, you can use pkfind as a replacment in you script. For your script, it is

pkfind iy:=[graph1]layer1!plot(1) method:=win option:=p width:=50 height:=30 smooth:=0

But the result of pkfind is a little different from pkrect. It is indices of original data. You need to do one more step to find out exact value. We are going to add exact value of peak info to pkfind in SR4.

For more reference of pkfind, please type "help pkfind" in command window to check the CHM. Or you can open XF Script Dialog (press F11) to see a script example.

Echo
OriginLab Corp
Go to Top of Page

marrotx

Germany
Posts

Posted - 09/11/2008 :  05:13:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello again,

thank you for the fast reply to my question.

Indeed, one attempt to solve my problem was the pkfind-function!
Unfortunately, the documentation for this function is lacking!!!
"help pkfind" in the command line gives no results.
Searching for "pkfind" in the origin help gives the page about "Peaks and Baselines" (one example for the use of pkfind, but nothing more)
The XF script dialog gives another example, but even no documentation.
So, I can find some few examples (wiki.origin) where the functions is used, but no complete documentation about all its features. Here, I read about the "method:=win" for the first time.

Maybe, you can post the documentation here, than I won't have to search other (empty?) sources...

Thank you in advance,
marrotx
Go to Top of Page

Echo_Chu

China
Posts

Posted - 09/11/2008 :  06:05:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

It looks like you did not get the SR3 document yet. However, you can refer to this page for the help document of pkfind.

I hope it helps.

Echo
Go to Top of Page

marrotx

Germany
Posts

Posted - 09/12/2008 :  03:59:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, that's what I wanted to know.
Go to Top of Page

marrotx

Germany
Posts

Posted - 09/12/2008 :  07:03:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi once again,

I now have installed the SR3 patch, nevertheless the help on pkfind is not available. But due to your link this is not the problem anymore.

My script now has the problem that it does not process the pkfind from the script. If I enter the same command (copy+paste) in the command line just after the whole script fails, everything works fine

Here is the script which I'm running after a file import:
(the relevant line is marked red)

rc=1;
resname$=res$(rc);
win -r book1 %(resname$);
wks.col1.name$=channel$(rc);
wks.col2.name$=intensity$(rc);
wks.col1.label$=channel;
wks.col2.label$=intensity;
stats ix:=Col(intensity$(rc));
for(ii=1;ii<stats.n;ii++)
{
if(Col(intensity$(rc))[ii]!=0)
{
first=ii;
ii=stats.n;
}
}
for(ii=stats.n;ii>0;ii--)
{
if(Col(intensity$(rc))[ii]!=0)
{
last=ii;
ii=0;
}
}
range aa = Col(intensity$(rc))[$(first):$(last)];
differentiate iy:=Col(intensity$(rc)) order:=1;
wks.col$(3).name$=differential$(rc);
wks.col$(3).label$=differential;
smooth iy:=Col(differential$(rc))[$(first):$(last)] method:=fft npts:=10 cutoff:=0.1;
wks.col$(4).name$=smoodi$(rc);
wks.col$(4).label$=smootheddifferential;
plotxy iy:=Col(smoodi$(rc)) plot:=200;
win -r Graph1 gedges$(rc);
page.label$="Graph for edge detection";
win -a %(resname$);
wks.addcol();
wks.col5.name$=edges$(rc);
wks.col$(5).label$="peaks of smoothed differential";
win -a %(gedges$(rc));
pkfind iy:=[gedges$(rc)]layer1!plot(1) method:=max filter:=num value:=4 npts:=50 ocenter:=[%(resname$)]%(sheet$)!col(edges$(rc)) oleft:=no oright:=no
p2=col(edges$(rc))[1];
p3=col(edges$(rc))[2];
p4=col(edges$(rc))[3];
p5=col(edges$(rc))[4];
plotxy iy:=aa plot:=200 legend:=1;
win -r graph1 %(resname$);
label -xb channel (a.u.);
label -yl intensity (a.u.);
label -s -n label %(resname$);
nlsf.addfunc(Resolution,D:\OriginLab\FitFunc,10);
nlsf.func$=griderfCu;
nlsf.clearupfitdata();
nlsf.fitdata$ = %(1,@D);
nlsf.tolerance = 1e-9;
nlsf.xBegin=$(first);
nlsf.xEnd=$(last);
nlsf.xPoints=1000;
nlsf.p1=stats.max;
nlsf.p2 = $(p2);
nlsf.p3 = $(p3);
nlsf.p4 = $(p4);
nlsf.p5 = $(p5);
nlsf.p6 = 10;
nlsf.p7 = 10;
nlsf.p8 = 10;
nlsf.p9 = 10;
nlsf.p10 = stats.min;
nlsf.fit(10);
nlsf.report();
resolution=2,35*12,7/((nlsf.p5-nlsf.p3+nlsf.p4-nlsf.p2)/2)*((nlsf.p6+nlsf.p7+nlsf.p8+nlsf.p9)/4);
label -sl -a 500 0 "resolution=$(resolution)";
rc=rc+1;


I'm sorry for all the code, but maybe it will help...

Best regards,
marrotx

Edited by - marrotx on 09/12/2008 07:06:15 AM
Go to Top of Page

Echo_Chu

China
Posts

Posted - 09/18/2008 :  04:03:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, marrotx

From your code it looks like you don't want to ouput oleft and oright. If so, it should be set as <optional> such as

pkfind method:=max filter:=num value:=4 npts:=50 oleft:=<optional> oright:=<optional>

Echo
OriginLab Corp
Go to Top of Page

marrotx

Germany
Posts

Posted - 09/26/2008 :  10:55:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you...

But obviously, that was not the problem :-(
It does not work either.

I found a second problem:
When I run the script in parts ("run.section..."), the script accepts no commands behind the nlsf.fit() line. The fit works (the parameters are fitted), but nothing afterwards (even no "newbook" or other simple command...).
Do I have to nlsf.end() the fitting session? I found no example where this was necessary.

Best regards,
Marrotx
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