Format for initial values in Batch Multipeak Fitting

Hi,

 

I am looking to batch fit a large number of Thermogravimetric Analysis (TGA) data - actually the derivatives.  I have been playing the multipack fitting and gotten some good results that I would like to use seed points for the fitting.  There are three peaks: two Gaussian and exp mod Gaussian.  I understand that I can set the peak types by setting the string variable under peak type.  What I am less clear on is initial guesses.  What should the format of the coefficients wave be especially given two types of waves?

TIA

Andy

Unfortunately, the provided MPF2_AutoMPFit() function (and the shiny new UI for it in Igor 9 provided by chozo) doesn't allow you to mix peak shapes, so you will need to roll your own. If I were you, I would start from MPF2_AutoMPFit().

The way MPF2_AutoMPFit() handles the coefficients is by taking a coefficient wave for the baseline function and one for each of the peaks. So in your case, you would provide 4 coefficient waves.

MPF2_AutoMPFit() is organized on data folders- one for each of your data sets. If you have data in a matrix, you would need to extract individual columns (or rows?) into separate waves and data folders.

Read about MPF2_AutoMPFit(): DisplayHelpTopic "MPF2_AutoMPFit()"

To be more explicit: for the Gaussian peaks, the coefficient waves need 3 elements. The ExpModGauss peak requires 4 elements.

In reply to by johnweeks

Hi John,

The manual specifically states that you can mix peak types.

The Fit Settings Section
This section is straight-forward: Just select which peak and baseline type you want to use and how the initial guesses should be handled. You can choose a peak type that will be used for all peaks directly from the drop-down menu, or you can set up a list of different peak types that will be assigned to individual peaks in each fit. Select the Custom String List option to use a list of peak types. A message box will appear, prompting you to input a string list like "Gauss;Gauss;Voigt;" (note the ';' character terminating each entry). Each item in this list assigns a peak type to one peak starting from the first peak in ascending order. If the number of peaks to fit is exceeding the number of provided peak types then the first list entry is used for all remaining peaks (which would be 'Gauss' in above example). The same list of peak types is reused for all data sets (you cannot define a different list for each data set).

 

As far as initial conditions, the approach I have taken is to do a manual fit and then dive into the results folder in the private data folder and copy the peakcoef waves to the active directory.  I then rename then to match the position in the sting list.I set the autowind to option 0 to use the copied waves as the starting points. My initial testing thinks this might work, but I am not declaring victory yet.

 

Andy

Gosh! I'd forgotten that chozo put that in. Previously, my lazy implementation didn't handle that.

Great that this stuff is already put to use! Hope everything works.

I get from your post, that you want to set up the initial guesses yourself (i.e., modes 0-2), right? If you let the guesses to the AutoMPFit code, then the coefficient waves will be created automatically. Your approach goes in the right direction. In the end, what you need is the right number of coefficient waves in the right order and with the required number of coefficients. Let's assume your coefficient waves have 'peakcoef' as base name and that your peak setup is "Gauss;Gauss;ExpModGauss;". What is your baseline? I assume constant? Then you simply prepare a result folder for each of your data sets and put in this:

Make/D/O blcoef = {0}   // baseline
Make/D/O peakcoef_0 = {2, 3, 12}   // peak 1
Make/D/O peakcoef_1 = {5, 3, 5}   // peak 2
Make/D/O peakcoef_2 = {10, 2, 20, -0.1}   // peak 3

Here I have used fixed values for the initial guesses. The order is location, width and height, and also asymmetry for the EMG peak. Your script could, for example, scan your input data to get better initial guesses (like position and height from the wave's maximum).

It is also very easy to write a script for preparing the folders and setting up the right things in tandem with the AutoMPFit GUI, like grabbing the list of data sets from the panel and also flipping the right switches in the GUI before the fit. I recently did that to fit a series of similar but widely shifted spectra. I want to write a tutorial about this at some point. But if you already have specific questions on how to do that let me know (i.e., write a forum post so that everybody can gain something).