Skip to content

Commit

Permalink
redefine COI by replacing sqrt(2) by 2 (i dont know how that factor a…
Browse files Browse the repository at this point in the history
…ppeared originally)
  • Loading branch information
lschneiderbauer committed Jan 1, 2025
1 parent 774d9e1 commit 5041e60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions R/fcwt.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
#' 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{4 \Sigma_t = 2 * \sqrt{2} \frac{\sigma}{f}}, and so a wavelet touches
#' \eqn{4 \Delta t = 4 \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{4 \Sigma_t}. Values that fall into that range are removed
#' is less then \eqn{2 \Delta t}. Values that fall into that range are removed
#' if `remove_coi = TRUE`.
#'
#' @param n_threads
Expand Down
8 changes: 4 additions & 4 deletions R/fcwtr_scalogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ sc_coi_mask <- function(x) {
#' @noRd
coi_mask <- function(dim_t, dim_f, sample_freq, freq_begin, freq_end,
freq_scale, sigma) {
# The standard deviation Σ of a the Gauß like wave packet at frequency f
# The standard deviation Dt of a the Gauß like wave packet at frequency f
# and sampling frequency f_s with given σ is given by
# Σ = σ / sqrt(2) f_s / f
# Dt = σ / f
# we choose 4Σ to define the support of a wave packet
# (and so boundary effects are expected to occur until 2Σ)
coi_pred <- \(f, t) ddu(t * f) < sqrt(2) * sigma
coi_pred <- \(f, t) ddu(t * f) < 2 * sigma

# express in dimensionless quantities
t <- rep(1:dim_t, times = dim_f)
Expand All @@ -84,7 +84,7 @@ coi_mask <- function(dim_t, dim_f, sample_freq, freq_begin, freq_end,
# invalid time steps on one side of the time series
# invalid meaning: at least one frequency in that time range has invalid value
coi_invalid_time_steps <- function(sample_freq, freq_begin, sigma) {
as.integer(ddu(floor(sqrt(2) * sigma * sample_freq / freq_begin)))
as.integer(ddu(floor(2 * sigma * sample_freq / freq_begin)))
}

sc_dim_freq <- function(x) {
Expand Down
4 changes: 2 additions & 2 deletions man/fcwt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5041e60

Please sign in to comment.