Multi-Peak Fitting Repetitive function
Corbeau_Mort
I am treating temperature dependent Infra-red spectra and therefore trying to code a function that will perform a multi-peak fit on a definite region on the spectra.
My data is organised as a single X wave and several Y waves (one per degree). I have managed for now to code this for a simple gaussian fit and now i am struggling to make it perfrom a multi-peak fitting.
Here is the basic code i have written if it can help.
Function TEST(baseName, fitname, startIndex, endIndex)
String baseName, fitname
Variable startIndex, endIndex
Variable index = startIndex
do
Wave w = $(baseName + num2istr(index))
Display w vs wave0
Setaxis bottom 2200, 2300
Make/D/O/N=4 $(fitname + num2istr(index))
Wave v= $(fitname + num2istr(index))
CurveFit/NTHR=0/M=2/W=0/TBOX=(0x309) gauss kwCWave=v, w[3722,3837]/X=wave0[3722,3837] /D
Index +=1
while (index<= endIndex)
End
I would be extremly grateful if someone could find the time to help me.
Thank You.
Corbeau Mort
Multipeak Fit comes with a function for doing batch fits that you may be able to use, or at least that you might be able to modify for your needs:
DisplayHelpTopic "MPF2_AutoMPFit()"
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 2, 2012 at 08:52 am - Permalink
Sorry to bother you once more but how can I impose a subrange with the "MPF2_AutoMPFit" function??
August 14, 2012 at 04:41 am - Permalink
That is one of the things that will require modifications to MPF2_AutoMPFit(). Interestingly, another of our programmers recently answered a similar question as a tech support incident. If you e-mail support@wavemetrics.com, perhaps he would share his answer with you.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 14, 2012 at 09:23 am - Permalink
I solved this problem by interpolating my waves and creating duplicate over the specific subrange and finally fitting the duplicates.
Corbeau Mort
August 16, 2012 at 08:25 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 16, 2012 at 09:25 am - Permalink