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
 Forum for Origin C
 NLSF.iterate(1) error message - OriginC
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

srosekra

USA
Posts

Posted - 08/23/2005 :  4:29:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version 7.0382:
Operating System: win2000Pro

I have the following code:
...
using NLSF = LabTalk.NLSF;
NLSF.Init();
//NLSF.PasteToPlot = 1;
NLSF.Func$ = "Lorentz";
NLSF.numReplica = 0;
NLSF.wType=0;
NLSF.w$="";
NLSF.chisqrerr=1;
NLSF.dataBegin = 646;
NLSF.dataEnd = 754;
NLSF.cleanupfitdata();
NLSF.FitData$ = "junkd10_B";
//NLSF.Execute("parainit");
if(NLSF.iterate(1)==-1) //ERROR MESSAGE OCCURS HERE
return 1;
NLSF.iterate(2);
NLSF.iterate(3);
...

I am basically using the call
LT_execute("run.section(fit,Fit1Peak,Lorentz)");
but I call it the long way above to avoid any graphical presentation, which slows my program. When using either method (LT_execute or the long version above) the first iterate sometimes causes an error message to be displayed -> "The fitting process has stopped as requested".
What causes this? It is hit or miss. Sometimes it will happen the first time I run it and I will not change anything run it again and it will not occur. How can I prevent it?

Mike Buess

USA
3037 Posts

Posted - 08/23/2005 :  5:22:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you just want to suppress the error message try adding NLSF.msgPrompt=0; after NLSF.init();

Mike Buess
Origin WebRing Member
Go to Top of Page

srosekra

USA
Posts

Posted - 08/23/2005 :  6:51:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That is a great find and I will definetely be using it to keep the message window from disturbing the flow of the program. I still need to fit it though. I was wondering what causes it, so that I can make sure the fit is successful. Is there somewhere where the method .iterate() is documented, I am not quite sure what it does, what the return value means, except what little is in the NLSF help file.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/23/2005 :  9:18:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
From the nature of the message I'm guessing that it's merely an artifact of requesting a single iteration. I bet NLSF.iterate(10) or NLSF.iterate(100) doesn't give the error. Shouldn't take that much longer either.

...From the programming guide NLSF.iterate() topic
quote:
If the tolerance value (see the Origin Help file) is satisfied, the fitter stops before the specified number of iterations are finished.
So you don't gain anything by iterating once, then twice, then three times as you have done. Better off asking for several iterations at once.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/23/2005 9:29:02 PM
Go to Top of Page

srosekra

USA
Posts

Posted - 08/24/2005 :  2:47:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It happended when I put in 10 or 100, but while trying your suggestion I think I may have stumbled upon the reason it occurs:

While debugging my code I would use the "Stop Debugging" button (Alt+F5) and upon returning to the code or any fitting routine it would display the error message. I stopped using Alt+F5 and haven't seen the error since. I can't think of any other reasons why the error message would occur.
Go to Top of Page

srosekra

USA
Posts

Posted - 08/24/2005 :  2:49:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike,
Thanks for the tips and help.
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