Expfit Peak Fitting Utility For Ms-Excel
Expfit Peak Fitting Utility For Ms-Excel
eXPFit is a peak fitting utility/template running under Microsoft Excel. It has been specifically set-
up for the analysis of X-ray photoelectron spectroscopy (XPS) data, but it could be used to fit other
types of spectroscopic data.
This software is suitable for those people who commonly use Excel for manipulating data and
assumes a certain familiarity with Excel.
Within these constraints it provides great flexibility, but if you want a completely robust, user-proof
or computationally-efficient peak fitting routine then look elsewhere; this software makes no
pretence of meeting any of these requirements !
Features
Conditions of Use
This software utility is supplied free-of-charge for personal use by individuals at home, or for
anyone working in an academic (college, university etc.) environment. However, please note the
Disclaimer regarding its use. The software must be registered and the requisite licensing payment
made to the author (see below) before use in any other commercial or other non-academic
research environment.
The Visual Basic code is not particularly efficient but runs quickly enough on modern PCs. The
workbook was originally prepared and tested using the version of Excel distributed in Office 97, but
it has been tested and shown to work with all subsequent releases of Office up to and including
Office 2007, provided that the installation instructions given in the documentation below are
followed.
Installation
This workbook is designed to be operated exclusively from the “Ft” worksheet, and any alterations
that you make to other sheets of the workbook may affect the way that it operates. You may wish
to run Excel in the Full Screen mode (select this option from the View menu/tab) if you are using a
small display.
The Settings button enables you to alter the spectral (binding energy) range over which the fitting
program operates - this is assumed to be the appropriate range for the data which you are
attempting to fit but no check is made to confirm this. You are required to supply the Initial
Binding Energy, the Step Size (between individual points) and the Final Binding Energy - units are
assumed to be eV although this is immaterial for operation of the program. The step size may be
entered as a positive value even if the final binding energy is lower than the initial energy. Note
that some of the peak parameters are automatically reset when new settings are supplied.
(Warning - this operation can take a long time on some old versions of Excel).
If you use the Import New Data button facility, then the data to be fitted is assumed to be present
in another open Excel workbook. It is further assumed that the worksheet contains a number of
similar spectra in columns (e.g. a series of O 1s spectra), where each column contains a single
spectrum represented by the signal intensity (in integral counts) with a single header row
containing some form of spectral identification (e.g. the original filename); the basic structure is
illustrated below.
A B C D
1 BE / eV Spectrum 1 Spectrum 2 Spectrum 3
2 536.0 21345 22300 22356
3 535.9 21222 22356 22343
4 535.8 21192 22978 22401
If you wish to fit the spectra only over a more limited range of binding energies, then you will need
to delete the appropriate rows from this worksheet. It is recommended that you only have one
datafile open at any one time in addition to the main workbook; furthermore, if this contains
multiple sheets it will be easier if you make the required sheet the active worksheet before
switching to the main workbook.
When you click on the Import New Data button the display will switch to the first other open
workbook (i.e. hopefully the required datafile, although you can use the Window menu, or
Windows task-bar, to switch to another file). To select a spectrum (a column of data) you should
select the entire column by clicking on the column identifier header tab (the grey cell at the top
containing an alphabetic character). To transfer this data you should then press the Enter key, or
click on the OK button of the dialog box. The new data is placed in the second column (column B)
of the “Data” worksheet.
If you do not wish to use the Import New Data facility, then it is also possible to transfer new
spectral data onto the “Data” worksheet manually, using successive copy and paste operations.
The Shirley Bkgrd button will subtract a Shirley-type background using an iterative procedure. This
is done using a homewritten algorithm and you may wish to check the results against those from
other programs. The original data is transferred to the “Shirley” worksheet, whilst the spectrum
stored on the “Data” worksheet and displayed on the “Ft” worksheet becomes that obtained after
the background subtraction has been performed. All subsequent peak fitting is carried out on this
modified data.
Peak Fitting
Peak fitting is accomplished using the Solver Add-In provided with Excel, with the parameters
entered on the “Ft” worksheet being the starting values for the fit. As with all fitting program, it is
less likely to fail if these initial parameters (including the linear background parameters) give a
reasonable fit to the data. You should enter the peak parameters in a continuous fashion from the
left starting with Peak 1
(Warning - if the intensity of any peak is initially set to zero then both it and any peaks to the right
will be ignored in any subsequent fitting).
The meaning of the basic peak parameters should be self-evident - these being the peak location,
height, full-width-half-maximum (FWHM) and the fractional Gaussian character of the Gaussian-
Lorentzian peak function (0 = 100% Lorentzian, 1 = 100% Gaussian). However, to permit
asymmetry the left and right sides of each peak are assigned separate FWHM and Gaussian-
Lorentzian character values. Peak parameters may be set to numerical values or have their values
defined by Excel formulae (thus linking them to other parameters).
C2 Binding Energy eV 530.25 >0 =B2+2.1 Peak fixed at 2.1 eV to higher BE of Peak
1
C3 Peak Height 44700 0 =B3*2/3 Peak height constrained to 67% of that
of Peak 1
C4 Left FWHM eV 1.560 >0 =B4 Left peak width fixed to be equal to that
of Peak 1
C5 Right FWHM eV 1.760 >0 =C3 Right peak width fixed to be equal to left
peak width
C6 Left Gaussian % 0.700 0,1 =B6 Left peak profile fixed to be equal to that
of Peak 1
C7 Right Gaussian % 0.700 0,1 =C6 Right peak profile fixed to be equal to
left peak profile
Note :
1. to make a peak completely symmetric you simply need to set the parameters (FWHM and
fractional Gaussian character) for the right-hand side of the peak to be equal to those of the
left-hand side using Excel formulae.
2. two further parameters are available; these are the left-hand background and right-hand
background values which together define a linear background contributing to the fit to the data.
3. it is not possible to constrain the integrated areas of peaks (these are not parameters)
The procedure for starting the peak-fitting process is outlined below:
(ii) You will now need to manually start the Solver , using the entry on the Data tab (Office 2007),
or under the Tools menu (earlier versions).
When the Solver Parameters dialog box appears you should ensure that the cells whose
values may be automatically varied are correct. You can check this by clicking in the “By
Changing Cells” edit box and the cells will be briefly highlighted on the main worksheet. If
you wish to change these it is generally best to delete all the existing entries and then use the
mouse to select the cells to be varied. Hold down the Ctrl key whilst using the mouse to
make additional selections.
(iii) Press the Solve button on the Solver Parameters dialog box.
Note :
1. You can halt the fitting process at any time by pressing the Esc key.
2. It is possible to add constraints on the parameters within Solver, although this is not usually
necessary or particularly recommended. Nevertheless, if you do not, you must check that the
fitted-results are reasonable; in particular you are advised to check that the Gaussian-
Lorentzian mix of each peak is within the permitted bounds (0–1).
3. If you wish to pause and view the results after each iteration then this may be done using the
Options button on the Solver Parameters dialog box.
Troubleshooting
If the macros fail to run, giving various obscure error messages, then it is usually due to the
incorrect libraries being referenced.
Manually loading the Solver, whilst the spreadsheet is open, and then re-saving the Excel file often
solves this problem (this is the basis for the installation procedure described above).
You can also check the References associated with the macros using the procedures outlined in the
online Help of Excel.
Disclaimer
If you use this program then you do so at your own risk ! The author takes no responsibility for the
accuracy of any results produced by the program or for any actions you may base on them.
Contact Details