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
 Fit won't execute

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
ChristophPreis Posted - 04/25/2010 : 11:12:45 AM
Origin Ver. 8.0724 and Service Release 0 (Select Help-->About Origin):
Operating System: Windows7.

Hello,

I am trying to write a labTalk Script. The supposed to find the baseline of some data, substract the baseline, smooth the points and finally make a gauss fit of the point. Until smoothing everything works fine, but the gauss fit just won't execute. What am I making wrong? Script below.

Thanks in advance!

// Filename: Custom.ogs
// Purpose: The Custom Routine button on the standard toolbar will use this code, by calling
// the [Main] section
// Modifications:


////////////////////////////////////////////////////////////////////////////////
// Main Code
////////////////////////////////////////////////////////////////////////////////
[Main]

//X und Y setzen
for(int jj = wks.ncols-2; jj> 0; jj -= 3){
wks.name$ = DataSheet;
wks.col$(jj).type = 4;
wks.col$(jj+1).type = 1;
wks.col$(jj+2).type = 1;
}


// Minima finden & Untergrund löschen
for(int jj = wks.ncols; jj> 0; jj -= 3){

int rowMinLinks = 1000000;
int rowMinRechts = 1000000;
int xMinLinks = 0;
int xMinRechts = 1000;
for(int ii = 1; ii<100; ii+=1){
if(wcol(jj)[ii] < rowMinLinks){
rowMinLinks = wcol(jj)[ii];
xMinLinks = ii;
}
}
for(int ii = wks.nrows; ii>(wks.nrows-100); ii-=1){
if(wcol(jj)[ii] < rowMinRechts){
rowMinRechts = wcol(jj)[ii];
xMinRechts = ii;
}
}
for(int ii = wks.nrows; ii>0; ii-=1){
wcol(jj)[ii] = wcol(jj)[ii]-rowMinLinks+(rowMinLinks-rowMinRechts)/(xMinRechts-xMinLinks)*(ii-xMinLinks);
}

}

//smoothing
for(int jj = wks.ncols; jj> 0; jj -= 3){

smooth iy:=$(jj) method:=PF percent:=55 oy:=$(jj-1);
smooth iy:=$(jj-1) method:=SG npts:=10 oy:=$(jj-1);

}


//peak fit
for(int jj = [Book1]DataSheet!wks.ncols; jj> 0; jj -= 3){

nlbegin iy:=(1,2) func:=gauss nltree:=MyTree;
// Now fit
nlfit;
// and report results
(Book1, jj, 1) = $(mytree.xc);
type Baseline y0 is $(mytree.y0), Peak Center is $(mytree.xc), Width is $(mytree.w), Area is $(mytree.A);
// end the fitting session without a Report Sheet
nlend 1 1;



}
1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 04/27/2010 : 01:32:02 AM
Hi,

Please note that the X-Function nlbegin is available since Origin 8 SR2. So the gauss fit can not be executed in Origin 8 SR0. Please update to Origin 8 SR6 according to this page. Also, you should make a little change in your fitting script.

1>(Book1, jj, 1) = $(mytree.xc);
The % sign is needed before (Book1, jj, 1), so it should change to: %(Book1, jj, 1) = $(mytree.xc);

2>nlend 1 1;
To terminate a fit session without output report, the usage is: nlend 0;
For more information about this X-Function, please refer to nlend.

By the way, currently, the latest version is Origin 8.1 SR2, you can download a demo version to have a try as well.

Penn

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