Skip to contents

Orchestrates VMD/EMD/EEMD decomposition for one canonical t/s signal and returns either IMFs, a recomposed time series, or long/wide tables depending on output.

TS2IMF() is a worker. It does not detect or own record/component grouping. Use data.table grouping at the call site for TSL tables.

Usage

TS2IMF(
  .x,
  method = "vmd",
  K = 12,
  alpha = 2000,
  tau = 0,
  DC = TRUE,
  init = 0,
  tol = 1e-07,
  output = NULL,
  verbose = FALSE,
  boundary = "wave",
  stop.rule = "type5",
  noise.type = "gaussian",
  noise.amp = 5e-08,
  trials = 10,
  imf.remove = NULL,
  remove.Fo = NULL,
  keep.Fo = NULL,
  keep.Residue = TRUE
)

Arguments

.x

data.table with canonical t and s columns.

method

character. One of "vmd", "emd", "eemd" (default "vmd").

K

integer. Number of IMFs (default 12).

alpha, tau, DC, init, tol

numeric. Parameters for VMD.

output

character or NULL. One of "TSL", "TSW", "IMF" (default NULL).

verbose

logical. Engine verbosity (default FALSE).

boundary, stop.rule

character. EMD/EEMD parameters.

noise.type, noise.amp, trials

parameters for EEMD.

imf.remove

character or integer. IMF selection (optional). Character values remove explicit mode names such as "IMF1". Numeric values select IMF indices to remove: positive indices count from the first IMF, negative indices count from the last IMF, and both sets are unioned. For example, c(1L, -1L) removes IMF1 and the last IMF. Zero, non-finite, and out-of-range numeric values are ignored.

remove.Fo, keep.Fo

numeric length-2 (Hz) frequency band rules (optional).

keep.Residue

logical. If TRUE (default), include residue in the reconstruction of signal.R. If FALSE, signal.R is built only from the kept IMFs.

Value

Depending on output, returns TSL, TSW, IMF or a list with the decomposition.

Examples

t <- seq(0, 1, by = 0.01)
x <- data.table::data.table(
  t = t,
  s = sin(2 * pi * t) + 0.1 * sin(10 * pi * t)
)
imf <- TS2IMF(x, method = "vmd", K = 2, output = "IMF")
imf
#>       IMF    Fo[Hz]   BW[Hz] E[k]/Eo [%]
#>    <char>     <num>    <num>       <num>
#> 1:   IMF1 0.9765625 0.000000    40.57649
#> 2:   IMF2 1.3238237 0.467474    29.75344