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 to directly include the correct background function during curve fitting for analysis instead of subtracting data 'by hand'. Most of the background types provided here are also found as fit functions in the Multipeak-fit package 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.
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 ideally have a positive X scale starting from zero and at least the same total X width as the current spectrum (data not starting from x = 0 will be padded with zero values, and data which is too short may give the wrong result), like this one:
Basic controls in the user interface:
To start, 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: Reverts to the initial data.
- Save Background: Saves the current background (blue trace) and current preview of the subtracted data (green trace) into the currently active data folder.
- 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.
- Left & Right: 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.
- 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
- Background specific controls will appear, which are explained in tooltips.
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. If these parameters are omitted then the first and last points of the input data are used (this does not work with polynomial background). Here is an example (for data with an x-scaling from 0 to 40):
STRUCT BackRemoveStruct s
Duplicate/O inwave, $(NameOfWave(inwave)+"_bk")
Wave backwave = $(NameOfWave(inwave)+"_bk")
String statusmsg = GenerateBackground(s, inwave, backwave, from=10.5,to=37.7)
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
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)
// 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.41.zip|
|Version Date:||Mon, 05/17/2021 - 02:35 am|
|Version Patch Level:||41|
|OS Compatibility:||Windows Mac-Intel|
Igor Pro 9
Igor XOP Toolkit
Igor NIDAQ Tools MX