View source: R/dm_wavelet_reconstruct.R
| dm_wavelet_reconstruct | R Documentation |
Reconstructs a selected oscillatory component, or a selected period band,
from a dm_wavelet object using WaveletComp::reconstruct().
Requested periods are supplied in hours. They are internally
converted to the native wavelet period units used when dm_wavelet()
was computed, then passed to WaveletComp::reconstruct().
The function supports two modes:
mode = "extract" returns the selected cycle or band itself.
mode = "remove" returns the original series with the selected
cycle or band removed.
dm_wavelet_reconstruct(
x,
series = NULL,
mode = c("extract", "remove"),
period_hours = NULL,
lower_hours = NULL,
upper_hours = NULL,
lvl = 0,
only_sig = TRUE,
siglvl = 0.05,
only_coi = FALSE,
only_ridge = FALSE,
rescale = FALSE,
verbose = TRUE
)
x |
An object of class |
series |
Optional character vector of series names to reconstruct. If
|
mode |
One of |
period_hours |
Optional numeric vector of exact periods, in hours, to
reconstruct. If supplied, |
lower_hours |
Optional lower period bound in hours for band reconstruction. |
upper_hours |
Optional upper period bound in hours for band reconstruction. |
lvl |
Minimum wavelet power level to include in the reconstruction. |
only_sig |
Logical. If |
siglvl |
Significance level used when |
only_coi |
Logical. If |
only_ridge |
Logical. If |
rescale |
Logical. Passed to |
verbose |
Logical. If |
An object of class "dm_wavelet_reconstruct" with elements:
Matched function call.
Selected series names.
Reconstruction mode, either "extract" or "remove".
A list describing the requested selection in hours and in native wavelet units.
Named list of WaveletComp::reconstruct() outputs.
Tidy table with columns TIME,
series, original, reconstructed, difference,
and filtered.
Per-series table of periods actually used in the reconstruction, in native units and in hours.
Wide table with TIME in the first column and
one filtered series column per selected tree/series.
Minimal metadata copied from the parent dm_wavelet
object.
wv <- dm_wavelet(
x = gf_nepa17,
TreeNum = 1:2,
source = "raw",
make_pval = TRUE,
verbose = FALSE
)
# extract circadian component
rec_extract <- dm_wavelet_reconstruct(
wv,
mode = "extract",
lower_hours = 20,
upper_hours = 28,
only_sig = TRUE
)
# remove circadian component
rec_remove <- dm_wavelet_reconstruct(
wv,
mode = "remove",
lower_hours = 20,
upper_hours = 28,
only_sig = TRUE
)
head(rec_extract$filtered_wide)
head(rec_remove$filtered_wide)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.