FitSinglePeak2: Performs a peak fit (Initial values as vector).

View source: R/RcppExports.R

FitSinglePeak2R Documentation

Performs a peak fit (Initial values as vector).

Description

FitSinglePeak2 performs a peak fit. Gaussian, Lorentzian and Pseudo-Voigt peak shapes are supported.

Usage

FitSinglePeak2(
  yVals,
  xVals,
  peakType = 0L,
  param = as.numeric(c(0, 0, 0, 0, 0, 0, 0))
)

Arguments

yVals

y axis data.

xVals

x axis data.

peakType

peak model to use.

param

Vector of initial values (blOffset, blSlope, amplitude, fwhmLo, fwhmHi, peakPos, mu).

Details

Same as FitSinglePeak, but takes the initial values of the fit parameter as a vector argument instead of explicit parameters. Peak parameters are optimized using a Levenberg-Marquardt algorithm as implemented by the library lmfit. The following peak types are available:

peak type index peak function symmetric baseline
-1 Gaussian through highest point and its neighbours yes no
0 Gaussian yes no
1 Lorentzian yes no
2 Pseudo-Voigt yes no
3 Gaussian yes yes
4 Lorentzian yes yes
5 Pseudo-Voigt yes yes
6 Gaussian no no
7 Lorentzian no no
8 Pseudo-Voigt no no
9 Gaussian no yes
10 Lorentzian no yes
11 Pseudo-Voigt no yes

The function for peakType = -1 is not an actual peak fit but rather the Gaussian function (symmetric, no baseline) defined by the maximum intensity point and its neighbors. It is used to automatically generate guess values for position, width and amplitude if all peak parameters are set to 0.

Value

List with peak parameters.

See Also

Other Peak fitting functions: EvalMultiPeak(), EvalSinglePeak(), FitSinglePeak(), MultiPeakFit()


pasturm/TofDaqR documentation built on March 29, 2024, 12:10 a.m.