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
 Calling advanced fitting tool within script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tkcroat

USA
17 Posts

Posted - 04/05/2004 :  1:14:43 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there any way to call the automatic fitting tool within labtalk after initializing parameters and such? I’d like to automatically perform a multi-peak gauss fit (2 to 3 peaks) within a larger script. Often though without additional user input the fits are questionable. Rather than writing my own new script (to set parameters as fixed or variable, refit if fit is poor, etc.), the automatic fitting tool is already a nice interface which could accomplish this. Ideally when done with the fit, the rest of my script would then proceed. I suppose one could copy all the script into the before fitting and after fitting section of the advanced fitting tool, but this hasn’t worked for me (boundaries of fitting range in “script before fit” were not defined before attempted fitting).

Mike Buess

USA
3037 Posts

Posted - 04/05/2004 :  3:19:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
One approach is to prepare a script file (.OGS) that looks like this...

[BeforeFit]
- before fitting scripts... data selection, constraints, boundaries, etc. -
nlsf.control(fit); // open nlsf tool to the fit page

[AfterFit]
- after fitting scripts -

Then specify this for the nlsf "After Fitting" scripts...
run.section(OGSfileName,AfterFit);

And launch with run.section(OGSfileName,BeforeFit);

Second approach...

- before fitting scripts -
nlsf.control(fit);
for(i=1;i>0;) {
sec -p 1; // wait a second
if(nlsf.status==0) break;
// wait until fitting session is over
};
- after fitting scripts -

Mike Buess
Origin WebRing Member
Go to Top of Page

tkcroat

USA
17 Posts

Posted - 04/09/2004 :  3:17:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
A variation of the first approach worked, essentially putting the extra scripts into the "after fit" section.
I have discovered that this was initially not working because of weird behavior/bug in the advanced fitting tool (which I will describe in this searchable forum for the possible benefit of future users).
The advanced fitting tool must be closed in the proper manner or the fit will be reinitialized and the iterations performed will be lost. For example, if you click “more” on the advanced fitting tool, iterate until the gaussian fits are nice (in fitting session icon with the data points and stoplight), then choose another icon (like simulate curves, control parameters or whatever), then switch back to basic mode, then choose close, the fits are reinitialized as if you hadn’t iterated at all normally resulting in garbage fits. You must either choose "done" from the "fitting session" or return to basic mode from the "select function", "select dataset" or "fitting session" windows and then close the advanced fitting tool. If you return to basic mode from any other icons, the fits are re-initialized and thus normally garbage. Despite these problems I prefer the advanced fitting tool to the nlsfwizard as it seems more robust and feature-rich although it is not as straightforward and not extensively described in the origin help or the programming help files.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 04/12/2004 :  12:44:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Why do you need to return to Basic mode? For that matter, why use Basic mode at all in an Advanced Fitting tool. :)

Mike Buess
Origin WebRing Member
Go to Top of Page

tkcroat

USA
17 Posts

Posted - 04/14/2004 :  1:34:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The only reason I hit return to basic mode is that the done or close buttons are not present at the bottom of most windows of the advanced fitting tool (done is only seen in the fitting session window). I assumed that returning to basic mode and then closing the session would be an equivalent method of ending the fitting session, which is not the case.
Go to Top of Page

Mike

USA
357 Posts

Posted - 04/14/2004 :  4:51:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi tk,

It looks like you've run into a bug in the Advanced Fitting Tool. I gathered from reading your post that you were fitting multi-peak data sets and so I ran through a fit using similar data. If you do your fit, then go to the Simulate page, then to Basic Mode without having clicked the Done button on the Fitting Session page, the Tool loses your replica parameters. At this point, clicking Done will produce a bad result.

To verify this, do your fit, go to the Simulate page, to Basic Mode, then back to the Fitting Session page. Note that there is now only one set of parameter values (although a check of the Replicas page shows that the Number of Replicas is still set properly).

I will enter an item into our bug-tracking database. Thanks for reporting this.

Mike
OriginLab
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