Skip to contents

Fitting of multiple spectral lines by the same or different lineshape functions with variable parameters.

Usage

multipeakfit(
  x,
  peaks,
  profiles,
  wL = NULL,
  wG = NULL,
  A = NULL,
  wlgth.min = NULL,
  wlgth.max = NULL,
  id = NULL,
  max.iter = 200
)

Arguments

x

A data frame or tibble

peaks

A vector of the selected peaks center wavelengths

profiles

A vector of the lineshape functions for fitting

wL

A numeric of the Lorentzian full width at half maximum (overall initial guess)

wG

A numeric of the Gaussian full width at half maximum (overall initial guess)

A

A numeric of the peak area (overall initial guess)

wlgth.min

A numeric of the lower bound of the wavelength subset

wlgth.max

A numeric of the upper bound of the wavelength subset

id

A character specifying the spectra id (optional)

max.iter

A numeric specifying the maximum number of iteration (200 by default)

Value

Fitted value for each peak and the estimated parameters along with the corresponding errors

Details

The function uses minpack.lm::nlsLM, which is based on the Levenberg-Marquardt algorithm for searching the minimum value of the square of the sum of the residuals.

Author

Christian L. Goueguel