R/lspgram.R

Defines functions lspgram

Documented in lspgram

#' @rdname spectr
#' @export
lspgram = function(x, deltat, time, periodRange = c(18, 32), ofac = 50) {
  period = NULL
  checkX(x)
  time = checkTime(x, deltat, time)
  checkPeriodRange(periodRange)
  checkSingleNum(ofac, 1, TRUE)

  lspResult = lomb::lsp(
    x, time, from = periodRange[1L], to = periodRange[2L], type = 'period',
    ofac = ofac, plot = FALSE)

  spec = as.data.table(lspResult[c('scanned', 'power')])
  data.table::setnames(spec, 'scanned', 'period')
  spec = spec[period %between% periodRange]
  return(spec)}

Try the spectr package in your browser

Any scripts or data that you put into this service are public.

spectr documentation built on Feb. 7, 2022, 5:06 p.m.