cwt {CWT}R Documentation

Continuous Wavelet Transform

Description

Compute a 1D continuous wavelet transformation using 2st order derivative Gaussian wavelet.

Usage

cwt(t, scales, variance = 1, summed_wavelet = FALSE, threads = 1L)

Arguments

t

A data.table, matrix, or numeric vector where columns or values represent time (i.e., bands) and rows samples (i.e., pixels). Remember the transformation assume that columns or values are evenly spaced though time (i.e., bands at equal to sampling interval).

scales

A positive numeric vector describing the scales to compute. The minimum scale (i.e., scales = 1) is equal to sampling interval between columns.

variance

A positive numerber describing the variance of the Gaussian PDF used to scale. Default variance = 1.

summed_wavelet

If TRUE, it returns the sum of scales. If FALSE, each scale is returned.

threads

An integer specifying the number of threads to use. Experiment to see what works best for your data on your hardware.

Value

If summed_wavelet = TRUE, it returns a data.table where columns are the sum of wavelet scales. If summed_wavelet = FALSE, it returns an array (i.e., time, samples, and scales).

Author(s)

J. Antonio Guzmán Q.

Examples


time_series <- sin(seq(0, 20 * pi, length.out = 100))

# Using a numeric vector

cwt(t = time_series,
    scales = c(1, 2, 3, 4, 5),
    summed_wavelet = FALSE)

cwt(t = time_series,
    scales = c(1, 2, 3, 4, 5),
    summed_wavelet = TRUE)

# Using a matrix

times <- 100
frame <- matrix(rep(time_series, times),
                nrow = times,
                byrow = TRUE)

cwt(t = frame,
    scales = c(1, 2, 3, 4, 5),
    summed_wavelet = FALSE)

cwt(t = frame,
    scales = c(1, 2, 3, 4, 5),
    summed_wavelet = TRUE)


[Package CWT version 0.2.1 Index]