View source: R/reconstructTSL.R
| reconstructTSL | R Documentation |
Adds up, for each series of the tables of decomposeTSL, the
modes that a selection retains and, unless excluded, the remainder of the
series.
reconstructTSL(decomposition, selection, includeResidue = TRUE)
decomposition |
The list of tables of |
selection |
A table with the keys and |
includeResidue |
|
The reconstruction of a series is the sum of its retained modes and, with
includeResidue, its remainder. A series without retained modes sums
zero, and a method without remainder, as decomposeEWT, adds
none. With every mode and the remainder, the result follows the
reconstruction relation of the selected method. For EMD the sum recovers
the input up to rounding. In decomposeEEMD with the divisor
"realizations", it gives the signal plus meanNoise.
The order of the rows of the tables does not intervene.
A partial sum implements the declared selection; neither the sum nor the choice to include a remainder establishes that the result is free of noise.
A named list with one data.table table, reconstruction: the
keys of decomposition, t and s, on the grid and in the
order of signal.
selectModesTSL, measureModesTSL,
decomposeTSL
Time <- seq(0, 9, length.out = 3000)
Signal <- sin(pi * Time) + sin(2 * pi * Time) + sin(6 * pi * Time) +
0.5 * Time
# The same series under three IDs and three components.
TSL <- data.table::rbindlist(lapply(c("AT", "VT", "DT"), function(id) {
data.table::rbindlist(lapply(c("H1", "H2", "UP"), function(ocid) {
data.table::data.table(ID = id, OCID = ocid, t = Time, s = Signal)
}))
}))
Sifting <- list(stopRule = "doubleThreshold")
Decomposition <- decomposeTSL(TSL, method = "decomposeEMD",
control = list(sifting = Sifting),
by = character())
Metrics <- measureModesTSL(Decomposition)$metrics
# A minimum energy fraction of zero retains every mode: with the residue,
# the reconstruction is the signal.
Every <- selectModesTSL(Decomposition, metrics = Metrics,
criterion = list(rule = "energyFraction", minimum = 0,
action = "keep"))
Complete <- reconstructTSL(Decomposition, selection = Every$selection)
max(abs(Complete$reconstruction$s - Decomposition$signal$s))
# The modes in [2, 15] Hz, without the residue.
Band <- selectModesTSL(Decomposition, metrics = Metrics,
criterion = list(rule = "band", fMin = 2, fMax = 15,
action = "keep"))
Filtered <- reconstructTSL(Decomposition, selection = Band$selection,
includeResidue = FALSE)
head(Filtered$reconstruction)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.