Baseline Spline Fit

For fitting and subtracting spline type baselines to spectroscopic data. A spline is a continuous curve that passes through points ("nodes") selected by the user. This Igor procedure file provides an interface that allows the user to position the points and see the resulting baseline.
Baseline spline preview

How to use Baseline Spline Fit

A 1d wave must be plotted in a graph window before selecting 'Spline Baseline' from the Macros menu. A control panel will be added to the left of the graph window. When 'edit mode' is selected you can drag the nodes. The spline should update as the nodes are repositioned. Whilst in edit mode you can add a new node at any position on the graph by positioning the mouse cursor and clicking while holding down the control key. Nodes may be deleted by clicking them with the option key held down. Clicking anywhere in the graph window with the shift key held down (or clicking the 'edit mode' checkbox in the control panel) will toggle between node editing mode and 'normal' mode where you can interact with the graph as usual.
 

Panel controls

  • Data wave: select a trace for baseline correction. When switching between traces the nodes will retain their X-positions but will be placed on the selected data wave at those positions (unless they lie outside of the range of the data wave).
  • Akima: fit an Akima style spline through the nodes. Akima splines can have sharper bends than cubic splines.
  • PCHIP: fit a piecewise cubic Hermite interpolating polynomial through the nodes.
  • Cubic: fit a cubic spline through the nodes.
  • Ends: At the ends of the spline where the cubic function is not fully constrained select a method to add a constraint. 1st deriv.: match 1st derivative; natural: match 2nd derivative. Affects only cubic spline type.
  • Linear: connect the nodes with linear segments.
  • Smoothing: fit a smoothing spline, which does not have to pass exactly through the nodes. The degree of smoothing is adjustable.
  • Edit mode: toggle between node editing and normal modes.
  • Reset: set node positions by spacing a set number of nodes at regular intervals along the section of the data wave displayed in the graph window. No nodes will be set beyond the range of the graph axes.
  • Load: reload the node positions from a previous fit.
  • Subtract: creates a copy of the baseline and a baseline-subtracted output spectrum in the current data folder and appends them to the plot; saves the node positions in a 2d wave in the current data folder.

If you find this package useful, check out my Arc Hull and Baselines projects. The Arc Hull package creates 'algorithmically defined' baselines, and the Baselines package provides an interface for fitting various functions to masked regions of the spectrum. The three packages are converging toward a common format of control-panel based interface, and may eventually be combined into a single package.

Images:

Baseline spline preview

Project Details

Current Project Release

BaselineSpline IGOR.7.00.x-4.30

Release File: BaselineSpline430.zip
Version: IGOR.7.00.x-4.30
Version Date: Sat, 07/03/2021 - 09:36 am
Version Major: 4
Version Patch Level: 3
OS Compatibility: Windows Mac-Intel
Release Notes:
Final release for this project - development will continue as part of the baselines project.
View All Releases

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More