gauss2_fit {gcxgclab}R Documentation

Fitting to 2D Gaussian curve

Description

gauss2_fit fits data around a peak to a 2D Gaussian curve.

Usage

gauss2_fit(TIC_df, peakcoord)

Arguments

TIC_df

a data.frame object. Data frame with 4 columns (Overall Time Index, RT1, RT2, TIC), ideally the output from create_df(), or the first data frame returned from extract_data(), $TIC_df.

peakcoord

a vector object. The two dimensional time retention coordinates of the peak of interest. c(RT1,RT2).

Details

This function fits data around the specified peak to a 2D Gaussian curve, minimized with nonlinear least squares method nls() from "stats" package.

Value

A list object with three items. The first data.frame object. A data frame with three columns, (time1, time2, guassfit), the time values around the peak, and the intensity values fitted to the optimal Gaussian curve. Second, a vector object of the fitted parameters (a,b1,b2,c1,c2). Third, a double object, the volume under the fitted Gaussian curve.

Examples

file <- system.file("extdata","sample1.cdf",package="gcxgclab")
frame <- extract_data(file,mod_t=.5)
peaks <- top_peaks(frame$TIC_df, 5)
gaussfit2 <- gauss2_fit(frame$TIC_df, peakcoord=c(peaks$'X'[1], peaks$'Y'[1]))
message(paste('Volume under curve =',gaussfit2[[3]],'u^3'))
plot_gauss2(frame$TIC_df, gaussfit2[[1]])


[Package gcxgclab version 1.0.1 Index]