Spectra Background Remover - Subtract common spectroscopic background functions
Fri, 01/22/2021 - 08:49 pm
This project provides functionality for calculating and removing (subtracting) backgrounds from (1D) data. The main purpose is to correct inelastic scattering backgrounds from photoemission spectra, but some general background types for other purposes are included as well. Both an user interface for interactively subtracting backgrounds as well as a function for calculating backgrounds from input data is provided.
Note that it is always better, if possible, to directly include the correct background function into curve fitting directly instead of subtracting data 'by hand' for analysis. Most of the background types provided in this tool are also found as fit functions in the Multipeak-fit package (version 3) for Igor 9.
I tried my best to test everything thoroughly, but you should verify the correct behavior yourself for critical applications. Bug reports and suggestions for new features are welcome.
Basic controls in the user interface:
To start the user interface, select a (1D) wave in the Data Browser and then select 'Spectra Tools' -> 'Background Subtraction ...' in the top menu. Or use the command line:
- Subtract: Subtracts the current background (blue trace) from the data and then works with the subtracted data. This can be used to successively subtract multiple types of backgrounds one after another.
- Undo All: Reverts to the initial data.
- Type: Select the desired background function here.
- Fuzzy Range: The range is marked with the cursors and the Y height of the current data is used as start- and endpoints. The data is averaged over a certain range to smooth out noise. Set to zero if the range should end at the exact cursor location
- Left & Right Cursor: Shows and modifies the cursor positions, which mark the effective range for the background calculation. The cursors can be dragged directly in the graph as well.
- Export Background: Saves the current background (blue trace; name ending "_bck") and current preview of the subtracted data (green trace; ending "_net") next to the input data.
- Plot After Export: Activate to create a separate plot of the exported data when pressing the Export Background button.
- Overwrite & Quit: Overwrites the original data with the current spectrum (red trace). This will not have any effect on the original data if no background was subtracted in the first place.
- Background-specific controls will appear for each background function, which are explained in tooltips.
Included background types:
- Constant: Subtract a constant value.
- Step: Smooth step function which connects the two endpoints (using tanh()).
- Linear: Linear function through the two endpoints.
- Exponential: Normalized exponential function connecting the two endpoints.
- Polynomial: Polynomial function fitted within the selected range.
- Total Sum: The total sum inelastic scattering background after X. Li et al., J.Electron Spectrosc. Relat. Phenom. 63 (1993) 253-265
- Shirley: The iterative Shirley inelastic scattering background after A. Proctor and P. A. Sherwood, Anal. Chem. 54, 13-19 (1982)
- Tougaard: Three- and four-parameter universal scattering background after S. Tougaard, Surf. Interface Anal. 25: 137-154 (1997)
- Tougaard Data: Scattering background using scattering cross-section data after S. Tougaard, Surf. Interface Anal. 25: 137-154 (1997).
This data should have a positive X scale starting from zero and at least the same total energy range as the input spectrum, like this one:
(data not starting from x = 0 will be padded with zeros, and data which is too short may give the wrong result)
Running your own code:
You can generate backgrounds using the function:
GenerateBackground(backstruct, datawave, backwave, [from, to])
Populate the BackRemoveStruct structure with the desired parameters and provide both the original data (datawave) and a wave which the background will be written to (backwave). Both datawave and backwave need to have the same size and scaling. The 'from' and 'to' optional parameters are for setting the start and end positions of the background calculation in the wave's x scaling. If these parameters are omitted then the first and last points of the input data are used. Here is an example:
STRUCT BackRemoveStruct s // the structure contains all relevant parameters
BackRemoveInitialize(s) // initialize
s.Functype="Shirley" // we use the Shriley background
Duplicate/O inwave, $(NameOfWave(inwave)+"_bck")/Wave=backwave
String statusmsg = GenerateBackground(s, inwave, backwave)
The BackRemoveStruct structure looks like this:
String FuncType // Constant, Step, Linear, Exponential, Polynomial, Total Sum, Shirley, Tougaard, Tougaard Data
Variable avgPercent // y Values around range ends positions get averaged
// function specific:
Variable expScale // Exponential
Variable polyDegree // Poly
Variable fullLinear // Line
// for Step
Variable stepPos // x center position
Variable stepSmooth // smoothing value
// for Tougaard (universal CS parameters)
Variable TouSmooth // how much the insulator step for parameter T0 will be smoothed (should not be 0)
// Tougaard Data
Variable CSscale // scaling (default 1)
String CSdata // name of CS wave in current folder
// Shirley and Total Sum
Variable followData // follow data outside range
Variable smoothData // integer between 3 and 20
Current Project Release
|Release File:||Background Remover_v1.51.zip|
|Version Date:||Thu, 07/14/2022 - 03:10 am|
|Version Patch Level:||51|
|OS Compatibility:||Windows Mac-Intel|
Igor Pro 9
Igor XOP Toolkit
Igor NIDAQ Tools MX