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
 programming series fit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Dizzy

Germany
Posts

Posted - 11/23/2004 :  05:14:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 6.0 (maybe 7.0 or 7.5 is available soon)
Operating System: Win XP SP2
Hi!
I´m completely new to programming and would like to learn how to import, fit and afterwards display the data of the fit (parameter) with Labtalk or Origin C. I have a series of 300 data files. It will be convenient to fit automatically instead of fitting by hand. This is a temperature series of one sample excited by Laser, so the fits are either gauss, lorentz or voigt in the whole series. Also I may need to extract data first depending on the shape of the spectra the samples emit. These can be two peaks or more and they have to be fitted seperately.
All this seems too difficult to be done by a newbie.
Please help - thanks a lot...
Best regards
Tom

easwar

USA
1965 Posts

Posted - 11/23/2004 :  11:16:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tom,

So what you are looking for is code that will handle importing of multiple data files, extracting sections of the data such as identifying multiple peaks in the data, then fitting with specific nonlinear functions, and then generating a table of fit parameters for all the files imported...this is quite a bit of code to be able to discss on the forum.

There are many code segments that touch upon some of these areas in the LabTalk and Origin C forums that you may want to search for and try to adopt to your needs. You could then post specific questions.

I also want to point out that our distributor in Germany can help by providing custom code on a consulting basis to you. You may want to contact them and discuss.

Looks like your tasks will be easier to implement with version 7.5 where the import wizard feature can be used and programmed to perform custom analysis at the end of each import.

Easwar
OriginLab

Go to Top of Page

greg

USA
1380 Posts

Posted - 11/23/2004 :  11:39:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Check out the BATCH.OGS file found in your BUTTONS folder.

Open the Script Window and enter

run.section(%YButtons\batch,main)

(Origin 7.5 users :
%A = system.path.program$;
run.section(%AButtons\batch,main);
}


Go to Top of Page

Dizzy

Germany
Posts

Posted - 11/26/2004 :  06:58:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your replies.
I found a script for fitting, but can´t get it to run on my needs.

for (test=2; test<=%(SPECTRA,@#); test++){
%A=SPECTRA!wks.col$(test).label$;
output_ps[test-1]="%A";
nlsf.begin();
nlsf.func$="gauss";
nlsf.setDepend(y,%(SPECTRA,test));
nlsf.x$="SPECTRA_A";
nlsf.constr$="";
nlsf.p1=4025;
nlsf.p2=429;
nlsf.p3=6.8;
nlsf.p4=40618;
nlsf.tolerance=0;
nlsf.fit(150);
output_peak[test-1]=nlsf.p2;
output_error[test-1]=nlsf.e2;
nlsf.end();
}

The lines with "output_..." give me the message, that a column name cannot be blank. When delete these lines it works good on one column.
How can I get an output now where all the parameter are stored into a worksheet?
When I saw this first, I wondered where to find the syntax like "nlsf.begin()" and similar. In the labtalk.chm is nothing. Also this "output..." command wasn´t there.
What is @#? Where can I look it up?

Did I overlook some information?

Thanks

Tom
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 11/26/2004 :  08:11:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tom,

Don't know where you found that script but you missed the part that created the output worksheet. The script expects it to exist and gives an error when it can't be found. Go back to where you found the script and find out where and how a worksheet called output was created.

The nlsf object is Origin's curve fitting tool...

LabTalk Help->Object Reference->Alphabetical Listing->NLSF

Mike Buess
Origin WebRing Member
Go to Top of Page

Dizzy

Germany
Posts

Posted - 11/29/2004 :  04:41:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,
thanks for helping a "blind" man
Some how I get confused when I consider all help files including *.chm downloaded from Origin-homepage. All the Information on LabTalk are a bit scattered on many files.
OK now I found all I need.

Thanks

Tom
Go to Top of Page

Dizzy

Germany
Posts

Posted - 12/02/2004 :  05:03:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi all,
here is another problem:
As I sometimes need to see the quality of the fits, a graph with the data and corresponding fitcurve would be helpful. The Origin-help says that nlsf command produces a graph, but in the loop only one graph with all fitcurves is created. So how can it be changed that every data with its corresponding fitcurve is shown in their own graphwindow? I wonder why this isn´t done automatically.

for (test=2; test<=%(data2,@#); test++){
%A=data2!wks.col$(test).label$;
Result2_a[test-1]="%A";
nlsf.begin();
nlsf.func$="gauss";
nlsf.fitdata$=%(data2,test);
nlsf.x$="data2_A";
nlsf.constr$="";
nlsf.p1=100;
nlsf.p2=3.7;
nlsf.p3=0.02;
nlsf.p4=780;
nlsf.tolerance=0;
nlsf.fit(15);
Result2_b[test-1]=nlsf.p4;
Result2_c[test-1]=nlsf.p3;
nlsf.end();
}

Thanks for any idea...
Tom
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