Author |
Topic |
|
kemeyer
39 Posts |
Posted - 06/15/2010 : 10:49:08 AM
|
Origin Ver. 8.0 SR1 Operating System: Windows Vista
Hello,
I am trying to automate some data analysis and it calls for fitting Lorentzian curves to several peaks with a dataset. I found that the labtalk command fitpeaks type:=Lorentz npeaks:= someNumber works rather well, but I did not like that you have to double click on the peaks to select them. My program will be sifting through many of the fits, so I don't want to have to double click every time. However, I will know a general range that the peak will always be in for a certain batch of data, and I would like to use that instead.
Is there a way to alter this function or implement another to make several lorentzian fits based on a couple already known ranges that could be entered by the user?
Thank you for your time, Katie |
|
kemeyer
39 Posts |
Posted - 06/15/2010 : 10:59:02 AM
|
Actually, as far as the version goes, I'm programming with 8.1 SR1 but it needs to be compatible for another computer that runs version 8.0 |
|
|
easwar
USA
1964 Posts |
Posted - 06/15/2010 : 11:05:05 AM
|
Hi Katie,
the fitpeaks X-function does require user interaction to select peak location.
But there are other X-functions that are more flexible to control the fit where you can assign peak values programmatically instead of from gui. See this example: http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Curve_Fitting#Fit_Multiple_Peaks_with_Replica
If the peaks are well defined, one can simply specify number of replicas and Origin will auto initialize the parameters and perform the fit.
You can view other examples on this same page to see how the nlfit X0function can also be programmed by user specifying what the peak values are etc.
Easwar OriginLab |
|
|
kemeyer
39 Posts |
Posted - 06/15/2010 : 11:35:49 AM
|
Thanks! I will look into this option. Are there any pages explaining nlfit and nlbegin? I tried searching the wikipage and I couldn't find any topics on them-only their appearance in various examples. I'm learning labtalk as I program this automation so I really don't know anything about those two commands-this is the first time I've seen them. |
|
|
easwar
USA
1964 Posts |
Posted - 06/15/2010 : 11:40:57 AM
|
Hi Katie,
All X-functions are documented in the X-function reference/help file, which is accessible from the Help menu of Origin, and online copy also available here: http://originlab.com/www/helponline/Origin/en/Programming/Programming.htm
Also we ship a printed LabTalk Guide with 8.1, and same information is accessible from Help menu under Programming, plus it is also available online from the above link, select LabTalk Programming in left panel.
Easwar OriginLab
P.S. The latest/up to date information on all programming documentation is available from our wiki site: http://wiki.originlab.com/~originla/wiki/index.php?title=Main_Page Some of the material there may be for upcoming version, but most would apply to 8.1/8/0 |
|
|
kemeyer
39 Posts |
Posted - 06/15/2010 : 12:04:28 PM
|
Thanks so much! |
|
|
kemeyer
39 Posts |
Posted - 06/15/2010 : 2:38:35 PM
|
I have one more question...I tried out the nlbegin/nlfit/nlend x-functions and they work really well so far when I am messing around with them. I noticed though that it doesn't pop up the same information that the other x-function,fitpeaks, did. Is there a way to display all that data on the lorentzian fit I just made?
My other question is about the range. In the data I just looked at there was a large noise spike, and it was fitted with a replica instead of the second peak I wanted. Can you pick and choose ranges and still run it in a loop fashion shown in the example? For example, is it possible to define a range like this:
range aa = (1, 3[1-100], 3[400-500])
where you pick and choose sections of the y-column (in this case col3) to be fitted with the curves? Basically, I need a way for it to only make replicas for the peaks I want, rather than noise spikes. |
|
|
easwar
USA
1964 Posts |
Posted - 06/16/2010 : 09:56:44 AM
|
Hi Katie,
You cannot define a single range that combines two parts of the data. Instead what you can do is simply mask the part of the data that you want to exclude.
So for example if your data is in col(2) of the worksheet and the rows you want to leave out are 50 thru 75, you can issue the following command with the worksheet active: wcellmask irng:=col(2)[50:75]; Then you can run the nlbegin/nlfit commands and specify the right number of replicas (excluding the peak in the masked area) and that will work.
As for output, you can issue the command nlend output:=1; This will then create a report sheet that has all the information that the fitpeaks XF generates. Also the tree in script has all information from the fit if you want to programmatically access those values.
If you need further help with this, I suggest you contact tech support.
Easwar OriginLab |
|
|
|
Topic |
|
|
|