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
 NLSF slows down
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Malab

Germany
19 Posts

Posted - 09/14/2005 :  04:52:55 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version 6.0:
Operating System: Win2000

I have to fit over 4000 Datasets! I do it in a loop. In the beginning the fit is very fast, but after a while each reloop slows down.
I suppose that it can get together with the popup window, in which the fit result parameter are shown (after a while, the auto scrolling takes a long time). I don't need this window, but a was not able to dissable this. How can I do this?

Maybe someone knows another reason of my problem!

Mike Buess

USA
3037 Posts

Posted - 09/14/2005 :  07:07:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Pls show us your script.

Mike Buess
Origin WebRing Member
Go to Top of Page

Malab

Germany
19 Posts

Posted - 09/14/2005 :  07:42:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
nothing spectacular :-)
only simple fits with 2 or more lorentz functions

This only will work with 999 column because there are some bugs in V6.0! I have solved this bye switching to another worksheet (this is not applied in the code), but this is not the reason.

M=999;
for(i=1;i<=M-1;i++)
{
%P="Fitting DataSet $(i) of $(M-1) - $(i/(M-1)*100)%";
type %P;
nslf.begin();
nlsf.init();
nlsf.func$="lorentz";

nlsf.databegin=MyVarStart;
nlsf.dataend=MyVarEnd;
nlsf.datastep=1;
nlsf.pastetoplot=1;
nlsf.fitdata$=inp_Y$(i);

nlsf.numreplica=PEAKS-1;
nlsf.p1=0;
iii=1;
for(iPeak=1;iPeak<=PEAKS;iPeak++)
{
iii++;
nlsf.p$(iii)=MyVarCenter$(iPeak);
iii++;
nlsf.p$(iii)=MyVarWidth$(iPeak);
iii++;
nlsf.p$(iii)=29000;
}
nlsf.xmode=0;
nlsf.xPoints=inp!wks.nRows;
nlsf.iterate(Iter);
nlsf.iterate(Iter);
nlsf.iterate(Iter);
nlsf.end();

result_ID[i]=i;
result_y0[i]=nlsf.p1;
iii=2;
for(iPeak=1;iPeak<=PEAKS;iPeak++)
{
result_xc$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_w$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_A$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_height$(iPeak)[i]=(2*nlsf.p$(iii-1)/PI)*(1/(nlsf.p$(iii-2)));
}

result_ChiSquare[i]=nlsf.chiSqr;

}
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/14/2005 :  08:30:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I see nothing wrong with your script so your suspicion about the Results Log might be correct. You should be able to disable Results log reporting. In Origin 7.5 you can do that with the proper argument for nlsf.end()...

nlsf.end(8); // end fitting session but do not paste Fit Label to Results log

That argument is not documented in Origin 6.0 so it might not work. In that case you might try unchecking the Write Parameters to Results log option in the NLSF fitter.

Mike Buess
Origin WebRing Member
Go to Top of Page

Malab

Germany
19 Posts

Posted - 09/16/2005 :  07:38:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I think that's the point! Is there no Labtalk command for this Write Parameters to Results log option?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/16/2005 :  08:52:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The Results log report comes from nlsf.end() and I just told you how to suppress it in Origin 7.5. If that doesn't work in Origin 6.0 you can delay the nlsf.end() command until the end. That might be preferable anyway since all of your fits use the same function...

nslf.begin();
nlsf.init();
nlsf.func$="lorentz";
nlsf.pastetoplot=1;
M=999;
for(i=1;i<=M-1;i++)
{
%P="Fitting DataSet $(i) of $(M-1) - $(i/(M-1)*100)%";
type %P;
nlsf.fitdata$=inp_Y$(i);
nlsf.databegin=MyVarStart;
nlsf.dataend=MyVarEnd;
nlsf.datastep=1;
nlsf.numreplica=PEAKS-1;
nlsf.p1=0;
iii=1;
for(iPeak=1;iPeak<=PEAKS;iPeak++)
{
iii++;
nlsf.p$(iii)=MyVarCenter$(iPeak);
iii++;
nlsf.p$(iii)=MyVarWidth$(iPeak);
iii++;
nlsf.p$(iii)=29000;
}
nlsf.xmode=0;
nlsf.xPoints=inp!wks.nRows;
nlsf.iterate(Iter);
nlsf.iterate(Iter);
nlsf.iterate(Iter);
result_ID[i]=i;
result_y0[i]=nlsf.p1;
iii=2;
for(iPeak=1;iPeak<=PEAKS;iPeak++)
{
result_xc$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_w$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_A$(iPeak)[i]=nlsf.p$(iii);
iii++;
result_height$(iPeak)[i]=(2*nlsf.p$(iii-1)/PI)*(1/(nlsf.p$(iii-2)));
}
result_ChiSquare[i]=nlsf.chiSqr;
}
nlsf.end();

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/16/2005 08:54:55 AM
Go to Top of Page

Malab

Germany
19 Posts

Posted - 09/19/2005 :  09:17:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ah ok, this code is ten times faster! Thank you!
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