Curve fitting

Multi-peak fitting and peak deconvolution

When two or more bands overlap on a sloping background—in Raman, FTIR, XRD, NMR, photoluminescence spectra, or chromatograms—fitting one isolated peak at a time truncates the shared wings and underestimates integrated areas. Joint multi-peak fitting solves for every component center, width, area, and the baseline parameters in one nonlinear least-squares model so wing overlap is apportioned rather than ignored.

Updated · 8 min read

On this page
  1. Why overlapping peaks need joint deconvolution
  2. Choosing Gaussian, Lorentzian, Voigt, or mixed shapes
  3. Detection, baselines, and center locking
  4. Reading residuals, AIC/BIC, and failure modes
  5. Native Mac alternative to Igor Pro and MagicPlot Pro for peak fitting
  6. Peak Deconvolution in Autoplot
  7. Frequently asked questions

Why overlapping peaks need joint deconvolution

In an additive 1D spectrum or trace, the measured signal at coordinate x combines an underlying background b(x) and K individual peak profiles:

y(x)=b0+b1x+∑k=1KPk(x)

Integrating raw intensity above a straight chord or fitting each maximum in a narrow sub-window works only when neighboring peaks sit many full widths apart. Once tails overlap—as in doublets, unresolved shoulders, or bands resting on fluorescence or thermal drift—clipping windows biases peak heights upward or downward, narrows apparent FWHM, and shifts peak centers toward the taller neighbor. At the same time, joint fits are not automatically unique: Maddams (1980) notes that unresolved shoulders and floating baselines easily trade off unless component count, line shape, or known band centers are physically constrained.

If your spectrum shows negative absorption dips rather than positive emission peaks, set the fit polarity before detecting candidates so both the baseline estimate and peak amplitudes carry consistent signs. For general model formulation before choosing a line shape, start with how to fit a curve to data.

Choosing Gaussian, Lorentzian, Voigt, or mixed shapes

Each peak profile parameterizes position by center μk, integrated area Ak>0, and intrinsic width parameters that determine both apex height and full width at half maximum (FWHM):

ShapeBroadening mechanismParameterization and FWHMWatch out for
GaussianInhomogeneous broadening, Doppler spread, or Gaussian spectrometer slitArea A, center μ, width σ; FWHM=22ln2σDecays too quickly in the wings; leaves negative/positive wing errors on lifetime-broadened peaks
LorentzianHomogeneous relaxation or finite excited-state lifetimeArea A, center μ, half-width γ; FWHM=2γHeavy 1/((x−μ)2+γ2) wings borrow intensity from the baseline if bounds are loose
VoigtConvolved Gaussian core and Lorentzian tailsExact Faddeeva evaluation w(z) over (σ,γ) with mixing η=γ/(σ+γ)Adds two shape parameters per peak; needs enough points and distinct wings to separate σ from γ
MixedHeterogeneous spectrum (e.g., sharp reference spike beside broad band)Independent G, L, or V shape per seed solved simultaneouslyIncreases model combinations; keep physical justification for each peak's assigned profile

In Autoplot, the Gaussian component takes P(x)=Aσ2πexp(−(x−μ)22σ2), the Lorentzian component takes P(x)=Aγπ((x−μ)2+γ2), and the Voigt profile evaluates P(x)=ARe[w(z)]σ2π at z=(x−μ)+iγσ2, using the Olivero and Longbothum (1977) linewidth approximation to seed an exact numerical FWHM root.

Autoplot Peak Deconvolution layer card for intensity against wavenumber, showing Detection with Positive polarity, Linear baseline, blank noise-adaptive thresholds, Max peaks set to 3, Detect Peaks and Add Peak Seed buttons, three unlocked peak seeds at 453.132832, 606.015038, and 884.210526, and Fit & style set to Gaussian
The Peak Deconvolution card separates automatic candidate finding, baseline model choice, and per-seed center locking before joint fitting.

Detection, baselines, and center locking

Multi-peak nonlinear least squares is non-convex, so two poorly placed seeds can swap positions, collapse onto one wide band, or pull a flat baseline upward. A structured five-step setup keeps the optimization stable:

  1. Restrict the fit window only where the model holds: set Fit X min and Fit X max to frame the spectral region of interest, leaving enough flank points outside the outer peaks to constrain the baseline slope without dragging in unrelated bands.
  2. Choose the simplest defensible baseline (None, Constant, or Linear): use Constant for a flat dark-count floor and Linear for slow fluorescence or thermal drift across the window. Autoplot initializes linear baselines from outer edge percentiles and asymmetric iteratively reweighted least squares (IRLS) so bright peaks do not pull the initial floor upward.
  3. Run prominence-based detection, then inspect every seed: when Prominence is left blank, Autoplot estimates high-frequency noise from second differences and sets a noise-scaled threshold before calling scipy.signal.find_peaks. Increase Min width, Min distance, or Max peaks to reject noise spikes, or click + Add Peak Seed to mark an unresolved shoulder the maximum-finder missed.
  4. Lock known peak positions when shoulders trade off: if two adjacent centers slide toward each other or produce huge parameter errors, lock a known reference line position (x₀) while keeping weaker neighbors free. The trade-offs around starting guesses, bounds, and collinear parameters are covered in nonlinear curve fitting.
  5. Run the joint solver and check parameter uncertainties: Autoplot optimizes all active peaks and baseline coefficients together with bounded Trust Region Reflective least squares (trf), then scales the Gauss–Newton pseudoinverse covariance by reduced chi-squared χred2=SSres/ν to report ± standard errors on centers, widths, areas, apex heights, and baseline terms.
Autoplot X&Y Plot of Intensity (a.u.) against cm⁻¹ (200 to 1200) showing Raw Spectrum, dotted red Total Fit, sloping Linear Baseline, orange Peak 1, green Peak 2, and purple Peak 3 Gaussian component curves resting on the baseline, yellow Detected Peaks drop-pin stems, and flat dotted Residuals around zero
Color-coded Gaussian components (orange Peak 1, green Peak 2, purple Peak 3) over the linear baseline and zero-centered residuals confirm both how the 453 and 606 cm⁻¹ doublet separates and that no shoulder band is missing.

Reading residuals, AIC/BIC, and failure modes

High R2 is easy to achieve across three peaks and reveals little about whether you chose the right number of components or line shape; as Major et al. (2020) show for X-ray photoelectron spectroscopy (XPS), adding unconstrained peaks lowers the raw residual sum while still producing unphysical widths and chemical-state assignments. Check four diagnostics under Results and on the plot:

  • Residual trace patterns: toggle Residuals on. Random noise centered on zero indicates a consistent additive model; an S-shaped dipole or positive bump sitting directly under a flank points to an omitted shoulder seed, while symmetric negative wings beside a sharp core usually signal that Gaussian tails decay too fast and need Lorentzian or Voigt. See how to interpret residual plots for reading systematic patterns.
  • Model comparison via AIC and BIC: keep the exact same [Fit X min, Fit X max] dataset window when comparing Gaussian vs Voigt or 3 vs 4 peaks. Because adding parameters always lowers RMSE, a meaningful improvement lowers AIC and BIC rather than inflating parameter standard errors.
  • Width-bound warnings: if a component width expands until it touches the upper bound (2 × span), that peak is usually acting as a surrogate curved baseline. Switch Baseline from None to Constant or Linear, narrow out unrelated continuum drift, or lock a constrained seed center.
  • Duplicate centers and tiny slices: putting two unlocked seeds of identical shape at the same x₀ creates collinear columns in the Jacobian, and slicing [Fit X min, Fit X max] below the total free parameter count fails validation. Keep several points per FWHM across every fitted peak.

Native Mac alternative to Igor Pro and MagicPlot Pro for peak fitting

If you previously relied on Igor Pro or MagicPlot Pro solely to deconvolve spectra on a Mac, the decision now splits by platform and constraint depth:

NeedAutoplotIgor ProMagicPlot / MagicPlot Pro
Mac platformNative Apple silicon (macOS 15+)9.05 Intel under Rosetta 2; 10 is Windows-onlyNative Apple silicon and Intel builds (3.2)
Peak and baseline modelsGaussian, Lorentzian, Voigt, mixed; none, constant, or linear baselinesBuilt-in and user-defined multipeak and baseline modelsMultipeak Gaussian, Lorentzian, Voigt, and baseline curves
Parameter controlLock individual centers (x₀); unweighted least squaresConstrained, coupled, global linked fits, and weighted least squaresLocked or joined parameters, weighted by Y errors, batch tables
Native files and handoffCSV/text import; peak tables, curves, and Python outOpens .pxp and .ibw; built-in procedure languageOpens .mppz; EPS, PDF, SVG, and EMF vector export

For routine single-spectrum multi-peak fitting from CSV or delimited text—especially if you are moving off Intel-only Igor Pro 9.05 without booting Windows—Autoplot handles peak finding, baseline fitting, component curves, AIC/BIC comparison, and multi-panel composition natively on Apple silicon. Keep Igor Pro when a workflow depends on global linked fits, acquisition XOPs, procedure files, or .pxp/.ibw experiments, and keep MagicPlot when you need .mppz project compatibility, coupled parameters, Y-error weights, or batch-series parameter summaries.

In Autoplot

Peak Deconvolution in Autoplot

Autoplot's Peak Deconvolution analysis (Run Analysis → Peak Deconvolution in any X&Y Plot, Plus — free for 30 days) runs candidate peak finding and joint multi-peak optimization locally on your Mac:

  • Inputs (Source & Detection): select Y and optional X (opt.) (defaulting to row index when omitted), restrict [Fit X min, Fit X max] if needed, choose Positive or Negative polarity and None/Constant/Linear baseline, adjust optional Prominence, Min width, Max width, Min distance, Height min, and Max peaks, then click Detect Peaks or + Add Peak Seed and toggle per-seed enable/lock states.
  • Model & overlays (Fit & style): switch globally between Gaussian, Lorentzian, Voigt, or per-seed Mixed shapes, toggle Show fit, Baseline, Components, Comp + base (adds the baseline under each component), Peak pins, and Residuals, customize line colors, strokes, markers, and Y offset, then click the orange gear button (Fit peaks / Refit peaks).
  • Results & exports (Figure Inspector → Results): inspect Peaks, R², Adj R², RMSE, AIC, BIC, χ²_red, DOF, baseline b₀ ± stderr / b₁ ± stderr, and the per-peak table (#, Shape, Center, Height, FWHM, Area, %), then export via Export Peak Table or Export Deconvolved Curves (curveX, totalFitY, baselineY, and component curves as Derived Variables). You can also set up and trigger deconvolution layers from the AI Assistant in Execute mode without sending raw numerical array values off your Mac.
  • Where it stops: optimization uses unweighted ordinary least squares over additive symmetric Gaussian, Lorentzian, and Voigt profiles; asymmetric Fano profiles, non-polynomial spline baselines, parameter inequality coupling across peaks, and per-point error weighting (σ_y) are not built into the card—use a custom SciPy workflow when those are required.

See features and pricing.

Frequently asked questions

Frequently asked questions
When should I choose Voigt instead of Gaussian or Lorentzian?Use Gaussian when broadening comes mainly from spectrometer resolution, thermal Doppler spread, or random inhomogeneity, and Lorentzian when natural lifetime broadening creates wide tails. Choose Voigt when both mechanisms contribute comparably, then verify that AIC and BIC improve without huge uncertainties on σ or γ.
Should I subtract a linear baseline before fitting overlapping peaks?No—keep Baseline set to Constant or Linear inside the deconvolution fit. Pre-subtracting a hand-drawn line ignores how baseline slope trades off against overlapping peak tails, whereas joint fitting estimates baseline b₀ and b₁ together with peak widths and propagates their covariance into peak areas.
What does locking a peak seed center do?Clicking the lock toggle on a seed removes that peak's center μ from the free parameter vector while keeping its amplitude and width parameters free. Use locking when an overlapping satellite shares the flank of a well-calibrated reference line whose position is known independently.
Does Autoplot support weighted least squares or asymmetric peak shapes in Peak Deconvolution?Not inside the Peak Deconvolution card: the solver runs unweighted Trust Region Reflective least squares over additive symmetric Gaussian, Lorentzian, and Voigt components with optional constant or linear baselines. For Y-error weighting or asymmetric Fano lineshapes, export your variables or run a custom SciPy least_squares script.
Can Autoplot replace Igor Pro or MagicPlot Pro for multi-peak fitting on a Mac?For single-spectrum overlapping Gaussian, Lorentzian, Voigt, or mixed peaks from CSV or text files, Autoplot replaces that workflow natively on Apple silicon without Rosetta 2 or Windows virtualization. Keep Igor Pro for global linked fits, procedures, and .pxp/.ibw files, and keep MagicPlot Pro for .mppz projects, coupled parameters, Y-error weights, or batch-series peak tables.

Sources

Algorithm details (detect_peaks_1d, asymmetric IRLS baseline initialization, bounded trf fit_multipeak_deconvolution, Faddeeva wofz Voigt evaluation, brentq Voigt FWHM solver, Gauss–Newton pseudoinverse covariance propagation, AIC/BIC, and χ²_red) and UI labels (Peak Deconvolution, Detection, Peak seeds, Fit & style, Comp + base, Peak pins, Residuals, Export Peak Table, Export Deconvolved Curves) were verified directly against Autoplot 2.3.0 / 2.4.0 source (math_logic.py, PeakDeconvolutionResultsView.swift, and Autoplot's Peak Deconvolution documentation) on 22 November 2026. Underlying numerical routines use SciPy's `find_peaks`, `least_squares`, and Faddeeva `wofz`. Overlapping-band uniqueness and baseline trade-offs draw on W. F. Maddams, "The Scope and Limitations of Curve Fitting," *Applied Spectroscopy* 34(3), 245–267 (1980), DOI `10.1366/0003702804730312`; practical XPS peak-fitting constraints and residual diagnostics draw on G. H. Major, N. Fairley, P. M. A. Sherwood, M. R. Linford, J. Terry, V. Fernandez, and K. Artyushkova, "Practical guide for curve fitting in x-ray photoelectron spectroscopy," *Journal of Vacuum Science & Technology A* 38(6), 061203 (2020), DOI `10.1116/6.0000377`; and Voigt half-maximum linewidth initialization draws on J. J. Olivero and R. L. Longbothum, "Empirical fits to the Voigt line width: A brief review," *Journal of Quantitative Spectroscopy and Radiative Transfer* 17(2), 233–236 (1977), DOI `10.1016/0022-4073(77)90161-3`90161-3).

Try it on your own data.

Autoplot detects 1D peaks and fits overlapping Gaussian, Lorentzian, Voigt, or mixed peak models with constant or linear baselines locally on your Mac. Part of Plus (free for 30 days).

Read how to interpret residual plots →
Download free for Mac

Apple silicon · macOS 15 or later · Free plan · Plus free for 30 days

Send to my Mac

Autoplot runs on a Mac. Send the link to yourself, or open it in the Mac App Store.