heap_grid: Recover the rounding grid from the leading spectral replica

View source: R/adheaping.R

heap_gridR Documentation

Recover the rounding grid from the leading spectral replica

Description

The leading tooth of the power spectrum sits at 2*pi/D, so the grid is Dhat = 2*pi / w_peak.

Usage

heap_grid(y, grid, near = NULL)

Arguments

y

heaped (rounded) sample.

grid

evaluation grid (equally spaced).

near

optional grid hint; if supplied the tooth is located in a frequency window around 2*pi/near (a verification that the comb sits at the expected grid); if NULL the first strong tooth beyond the signal lobe is taken (blind). The two modes are not equivalent. Over four targets at three grids the verifying mode returned the imposed grid in 12 of 12 cases and the blind mode in 0 of 12, so a blind reading should be treated as a candidate rather than as a recovered grid.

Value

The recovered grid width Dhat (or NA if no tooth is found).

Examples

grid <- seq(-6, 6, length.out = 2048)
x <- ifelse(runif(4000) < 0.5, rnorm(4000, -1.2, 0.5), rnorm(4000, 1.2, 0.5))
heap_grid(0.5 * round(x / 0.5), grid, near = 0.5)

adheaping documentation built on Sept. 18, 2026, 1:06 a.m.