Learn R Programming

wmtsa (version 1.1-1)

wavCWTPeaks: Peak detection in a time series via the CWT

Description

Finds the local maxima in a time series via a CWT tree.

Usage

wavCWTPeaks(x, snr.min=3, scale.range=NULL, length.min=10,
    noise.span=NULL, noise.fun="quantile", noise.min=NULL)

Arguments

x
an object of class wavCWTTree.
length.min
the minimum number of points along a CWT tree branch and within the specified scale.range needed in order for that branches peak to be considered a peak candidate. Default: 10.
noise.fun
a character string defining the function to apply to the local noise estimates in order to sumarize and quantify the local noise level into a scalar value. See the DETAILS section for more information. Supported values are [object Object],[object O
noise.min
the minimum allowed estimated local noise level. Default: quantile(attr(x,"noise"), prob=0.05), where x is the input wavCWTTree object.
noise.span
the span in time surrounding each branche's temrination point to use in forming local noise estimates and (ultimately) peak SNR estimates. Default: NULL,max(0.01 * diff(range(times)), 5*sampling.interval), where times and s
scale.range
the range of CWT scales that a peak must fall into in order to be considered a peak candidate. Default: scale[range(which(branch.hist > quantile(branch.hist,prob=0.8)))], where branch.hist is an attribute of the input wavCW
snr.min
the minimum allowed peak signal-to-noise ratio. Default: 3.

Value

  • a list of x and y vectors identifying the peaks in the original time series. The pruning criteria (snr.min, scale.range, length.min, noise.span, noise.fun, noise.min) are attached are attached as attributes. In addition, a peaks attribute is attached and corresponds to a data.frame containing the following information for each peak:
  • branchindex of the associated branch in the CWT tree
  • itimeindex location in time
  • iscaleindex location in scale
  • timelocation in time
  • scalelocation in scale
  • extremaCWT value
  • iendtimeindex location of branch termination time, i.e., the index of the point in the time series corresponding to the current peak

concept

peak detectionwavelet

Details

The local maxima of the CWT are linked together to form so-called branches, where each branch represents one ridge of the CWT time-scale terrain. The collection of branches forms a tree, as output by the wavCWTTree function. The wavCWTpeaks function prunes the branches of the input CWT tree and records the termination time (i.e., the time associated with point of the branch that is closest to scale zero) as the time index associated with the local peak of the corresponding time series. Information regarding the collection of isolated peaks is returned as a data.frame object.

The tree branches are pruned in the following ways: [object Object],[object Object],[object Object],[object Object]

NOTE: For peak detection, the wavelet filters used to form the CWT must maintain an (approximate) zero phase property so that the CWT coefficients can be meaningfully aligned with the events of the original time series. Currently, only the so-called Mexican hat wavelet maintains this property due to the even-symmetry of the filter's impulse response. Therefore, only the Mexican hat wavelet ("gaussian2") is currently supported for CWT-based peak detection. See the wavCWTFilters and wavCWT function for more information.

References

Pan Du, Warren A. Kibbe, and Simon M. Lin, ``Improved peak detection in mass spectrum by incorporating continuous wavelet transform-based pattern matching", Bioinformatics, 22, 2059--2065 (2006).

J.F. Muzy, E. Bacry, and A. Arneodo., ``The multifractal formalism revisited with wavelets.", International Journal of Bifurcation and Chaos, 4, 245--302 (1994).

See Also

wavCWTTree, wavCWT, wavCWTFilters.

Examples

Run this code
## create linchirp series 
linchirp <- make.signal("linchirp")

## calculate the CWT 
W <- wavCWT(linchirp)

## form CWT tree 
z <- wavCWTTree(W)

## estimate the peak locations using default 
## scale.range 
p <- wavCWTPeaks(z)

## plot an overlay of the original series and the 
## peaks 
x <- as(linchirp@positions,"numeric")
y <- linchirp@data
plot(x, y, type="l", xlab="time", ylab="linchirp")
points(p, pch=16, col="red", cex=1.2)

Run the code above in your browser using DataLab