makeSpec: Draw a Chromatogram or Spectrum In SpecHelpers: Spectroscopy Related Utilities

Description

This function creates a chromatogram or spectrum from a list of appropriate parameters describing the peaks. The individual curves are computed using the mathematical definition of either a Gaussian curve, possibly with tailing, or a Lorentzian curve. Gaussian curves are appropriate for simulating chromatograms or UV-Vis spectra, while Lorentzians are used for simulating NMR peaks. The function computes the individual curves as well as their sum (which is the whole chromatogram or spectrum). A plot can be made, which may display the separate underlying curves. If you want to draw NMR spectra, use plotNMRspec which is a much more natural interface to this function.

Usage

 1 2 makeSpec(peak.list, x.range, plot = TRUE, curves = FALSE, type = "gauss", noise = 0, dd = 1, ...)

Arguments

 peak.list For a Gaussian curve, a data frame with the following columns: mu, sd, area, tail. mu is the retention time (or center frequency). sd is the standard deviation (or peak width). area is the area under the peak. tail is the tailing parameter - use NA when a pure Gaussian with no tailing is desired. One row of the data frame contains data related to one peak. For a Lorentzian curve, a data frame with the following columns: x0, area, gamma. x0 is the center frequency or chemical shift. gamma is the half the peak width at half-height. area is the area under the peak. x.range A numeric vector of length 2 giving the retention time range (or frequency range) desired. Must make sense in light of the peak list given (i.e. a wider range, possibly much wider depending up the values of sd and tail), as these broaden the peaks. plot Logical; if TRUE, a plot is produced. curves Logical; if TRUE, the individual curves are plotted (provided plot = TRUE. Not very useful for NMR spectra, but great for showing, for instance, how shoulders arise on peaks in a chromatogram. type A character string. Use "gauss" to generate Gaussian curves (for chromatograms, or UV-Vis spectra). Use "lorentz" to generate Lorentzian curves as found in NMR spectra. noise A number giving the amount of noise to be added to the individual curves (the net spectrum has the noise from the individual spectra, it has no additional noise added to it). Value corresponds to the argument factor in function jitter. dd The density of data points per unit of x.range. The total number of data points used to create the spectrum or chromatogram is dd*abs(diff(x.range)) and thus it also depends on the units of x.range. This approach ensures that peaks are not distorted when changing x.range for the same peak.list. ... Additional arguments to be passed downstream.

Value

A matrix containing the x values (retention times or frequencies) in the first row, and the complete chromatogram (spectrum) in the second row. Additional rows contain chromatograms (spectra) of the individual components. The row names of the data frame are character strings describing the chromatogram (spectrum) in that row. The matrix contains dd*abs(diff(x.range)) columns.

Author(s)

Bryan A. Hanson, DePauw University. hanson@depauw.edu