From 846c9aabfa0cc202049ea6f706427f9c761a0495 Mon Sep 17 00:00:00 2001 From: Lukas Schneiderbauer Date: Sun, 5 Jan 2025 18:23:02 +0100 Subject: [PATCH] `fcwt()`: change argument name: remove_coi -> rm_coi --- R/fcwt.R | 10 +++++----- R/fcwt_batch.R | 2 +- man/fcwt.Rd | 8 ++++---- tests/testthat/test-fcwt.R | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/R/fcwt.R b/R/fcwt.R index ff2b58b..6f06cf6 100644 --- a/R/fcwt.R +++ b/R/fcwt.R @@ -76,15 +76,15 @@ #' sigma, it depends on the use case. So the default choice can very well be #' quite a bad choice (it probably is for audio data). #' -#' @param remove_coi ( [TRUE] | [FALSE] ) -#' Boundary effects can result in nonphysical artifacts. If `remove_coi = TRUE`, +#' @param rm_coi ( [TRUE] | [FALSE] ) +#' Boundary effects can result in nonphysical artifacts. If `rm_coi = TRUE`, #' those are effectively removed by setting corresponding values to [NA]. #' We define the essential support of the #' (Gaussian) wavelet to be four times its standard deviation, #' \eqn{\Delta t = \frac{\sigma}{f}}, and so a wavelet touches #' the boundary if the distance of the center of the wavelet to the boundary #' is less then \eqn{\Delta t /2}. Values that fall into that range are removed -#' if `remove_coi = TRUE`. +#' if `rm_coi = TRUE`. #' #' @param n_threads #' Number of threads used by the computation, if supported by your platform. @@ -138,7 +138,7 @@ fcwt <- function(x, ), freq_scale = c("log", "linear"), # abs = FALSE, - remove_coi = TRUE, + rm_coi = TRUE, n_threads = 2L) { stopifnot(is.numeric(x)) stopifnot(is.numeric(n_freqs), n_freqs > 0) @@ -193,7 +193,7 @@ fcwt <- function(x, freq_scale, sigma ) - if (remove_coi) { + if (rm_coi) { sc_set_coi_na(sc) } else { sc diff --git a/R/fcwt_batch.R b/R/fcwt_batch.R index 1ed68ab..af58f47 100644 --- a/R/fcwt_batch.R +++ b/R/fcwt_batch.R @@ -184,7 +184,7 @@ fcwt_batch <- function(x, n_freqs = n_freqs, freq_scale = freq_scale, sigma = sigma, - remove_coi = FALSE, + rm_coi = FALSE, n_threads = n_threads ) |> # we fully remove COI infected time slices diff --git a/man/fcwt.Rd b/man/fcwt.Rd index 14aff21..9896b67 100644 --- a/man/fcwt.Rd +++ b/man/fcwt.Rd @@ -14,7 +14,7 @@ fcwt( n_freqs = 3 * ceiling(log(du(freq_end/freq_begin), base = 1 + sigma_freq_res_rel(sigma))), freq_scale = c("log", "linear"), - remove_coi = TRUE, + rm_coi = TRUE, n_threads = 2L ) } @@ -72,15 +72,15 @@ are proportional to the frequency uncertainties. In this sense, the logarithmic frequency scale is actually the natural scale for the continuous wavelet transform.} -\item{remove_coi}{( \link{TRUE} | \link{FALSE} ) -Boundary effects can result in nonphysical artifacts. If \code{remove_coi = TRUE}, +\item{rm_coi}{( \link{TRUE} | \link{FALSE} ) +Boundary effects can result in nonphysical artifacts. If \code{rm_coi = TRUE}, those are effectively removed by setting corresponding values to \link{NA}. We define the essential support of the (Gaussian) wavelet to be four times its standard deviation, \eqn{\Delta t = \frac{\sigma}{f}}, and so a wavelet touches the boundary if the distance of the center of the wavelet to the boundary is less then \eqn{\Delta t /2}. Values that fall into that range are removed -if \code{remove_coi = TRUE}.} +if \code{rm_coi = TRUE}.} \item{n_threads}{Number of threads used by the computation, if supported by your platform. Defaults to 2 threads (to accommodate CRAN requirements). diff --git a/tests/testthat/test-fcwt.R b/tests/testthat/test-fcwt.R index 9bbe691..0477671 100644 --- a/tests/testthat/test-fcwt.R +++ b/tests/testthat/test-fcwt.R @@ -61,7 +61,7 @@ test_that("fcwt() removing coi works", { freq_end = 1000, n_freqs = 10, sigma = 1, - remove_coi = TRUE + rm_coi = TRUE ) # we have a time series that is 1000 / 44100 s long