generateSpectrum {Cardinal}R Documentation

Generate a Simulated Spectrum

Description

Generates a simulated spectral signal, or multiple such signals, with peaks of specified intensities.

Usage

generateSpectrum(n, peaks = 100,
    range = c(1001, 20000),
    centers = seq(
        from = range[1] + diff(range) / (peaks + 1),
        to = range[2] - diff(range) / (peaks + 1),
        length.out = peaks),
    intensities = runif(peaks, min=0.1, max=1),
    step = diff(range)/1e3,
    resolution = 500,
    noise = 0.05,
    sd = 0.1,
    baseline = 2000,
    auc = TRUE)

Arguments

n

The number of signals to simulate.

peaks

The number of peaks in the signal.

range

A pair of numbers specifying the range of continues feature values at which the signal is measured.

centers

The values of the singal feature at which peaks occur.

intensities

The values of the intensities of the peaks, which could either be heights of the peaks or their area under the curve.

step

The step size between measurements in the feature space.

resolution

The instrument resolution. This affects the width of the peaks. Higher resolutions produce sharper peaks.

noise

A value without scale that indicates the amount of noise in the signal.

sd

Standard deviation of the intensities of the peaks.

baseline

A value without scale that indicates the shape and size of the baseline.

auc

Should the peak heights be influenced by the area under the curve? This reflects fragmentation and limited accuracy at higher mass ranges. If 'FALSE' then the peak heights correspond directly to the provided intensities.

Value

A list with elements:

Author(s)

Kylie A. Bemis

See Also

generateImage

Examples

s <- generateSpectrum(1)
plot(x ~ t, type="l", data=s)

s <- generateSpectrum(1, centers=c(2000,3000), resolution=10, baseline=3000)
plot(x ~ t, type="l", data=s)

s <- generateSpectrum(1, peaks=2, auc=FALSE, baseline=0)
plot(x ~ t, type="l", data=s)

[Package Cardinal version 1.12.1 Index]