Multi-peak Fitting
If you have spectroscopic, chromatographic or other forms of data containing multiple, often overlapping peaks, you will appreciate Igor's multi-peak fitting package. This package, like many others included with Igor, can be accessed simply by choosing a menu item. In the resulting control panel, choose your x and y data, click Set and then Graph. Often, all you have to do is click Set again to invoke the automatic peak finder algorithm and then click the Do Fit button.
Individual peaks as well as the overall fit trace are provided. Optionally, the baseline can be shown as well. The residuals plot is very handy in deciding whether the fit is good or whether there may be additional peaks lurking in the data. In the following result after a fit, the residuals are just noise indicating a good fit:
Note: fitting to overlapping peaks has often been called "deconvolution." This is not strictly correct as the peaks are merely added together and not convolved in the mathematical sense.
Peak types
This package can fit multiple overlapping peaks using one of five basic peak fit types: Gaussian, Lorentzian, Voigt, ExpGauss and ExpConvExp The following graph illustrates the different types:
A Voigt is the convolution between a Gaussian and a Lorentzian. It includes a shape parameter that adjusts the relative contribution of the two. A shape factor of zero is pure Gaussian with the Lorentzian contribution increasing as shape increases. A Voigt is often used in spectroscopic and X-ray work.
ExpGauss is the convolution between a Gaussian and an exponential decay while ExpConvExp is the convolution of two exponenatial decays. These forms, with their tails on one side, can be useful in fitting chromatographic data.
Baseline
The package supports a constant baseline (offset) or a cubic polynomial. In general, it is much better to fit with a baseline function than to try to remove the baseline from the data and then fit. However, especially in cases where there is a clear distinction between baseline and peaks, you can use any other Igor capabilities to subtract out the baseline before the fit.
Setting initial values
The initial values for the fit, i.e., the number, placement and properties of the peaks, can be set in several ways. You can enter values numerically, use the auto peak finder, interactively draw or edit your peaks with the mouse or some combination of these methods.
Using AutoFind
By default, when you click the Set button when your data is in the top graph, an automatic peak finding algorithm is invoked. To turn this feature on or off and make other adjustments to the autofind method, click the "Auto..." button in the main control panel. The algorithm tries to guess the noise level of your data and, most critically, an optimum smoothing factor used on the second derivative of the data.
If the fully automatic peak find (set button) does not work for your data, you may be able to get better results by adjusting prameters in the AutoFind Panel. After a Set button-invoked autofind or after the Estimate Params button is clicked, the noise estimate and smoothing factor are displayed. You can make adjustments and then click the Find Peaks button to refine the search. You can also adjust parameters designed to reject spurious peaks.
Using Manual Peak Adjust
If the automatic peak find does not work for you or if you need to make adjustments to the peaks before fitting, click the "Man..." button in the main panel. The ManualPeaksPanel allows you to delete the current peak, insert a new peak or edit an old peak.
To delete a particular peak, first set the peak number in the Initial Values section of the FitSetupPanel. If you delete the wrong peak, click the Undo button.
To add a new peak, click Insert New Peak and then drag out a new peak on the graph. Press the mouse button at the top of the peak and drag right and down to define the height and width. The drawn peak is always gaussian regardless of the fitting function but when you release the mouse, the new peak will be the current type. You can draw any number of new peaks. When done, be sure to click the Finish Insert button (or close the ManualPeaksPanel).
To touch up an existing peak, click Edit Old Peak and then click and hold on one of the individually drawn peaks in the graph (thin red trace). You can drag the peak into a new position and when you release the mouse, you can adjust the width and height by moving the mouse to the right and down. Click again to finish the edit. After editing your peaks, be sure to click the Finish Edit button (or close the ManualPeaksPanel).
Click the Undo button to undo the last Delete, Insert or Edit. Click again to redo.
Fitting to sub-ranges
For some data sets, it is more efficient to fit several subsets of your peaks rather than all at once.
When you click the set button in the control panel, the current range of data displayed in the graph is stored. This range is then used in all calculations and fitting. Therefore, to fit to a sub-range of data, simply zoom the graph so it shows only the range you wish to fit and then click the Set button. The fitted data curve and the residuals curve are calculated only over the subrange.
Before you start to work on the first sub-range, you should execute the ZapFitAndResiduals() macro. This macro sets the fit curve and the residuals curve to NaN so that only your sub-ranges will be visible. After executing ZapFitAndResiduals, the first thing you should do is click the set button with the graph x-axis zoomed to the desired range.
If, after performing a fit to one sub-range of data, you want to work on another subrange of the same data set, chose the RenameGroup() macro from the Macros menu. This macro renames the data folder containing the coef wave, the W_Sigma wave and the Peak1, Peak2 etc. waves.
You can redo a fit to a given sub-range by choosing the RevisitGroup item from the Macros menu. The popup menu shows all the sub-range fits you have done. Before running RevisitGroup, you may want to rename the current group (otherwise, it will be given an arbitrary name).
Creating fit results
When you are satisfied with a fit, choose PrintPeakParams from the Macros menu. This prints a variety of result values to the history and also creates a pair of output waves containing values that you can use for further processing or reports. Values created include the peak position and area with estimated errors along with a number of other values that depend on the specific function.
Last updated: Friday, December 31, 2004