R/HilbertWithFT.R

Defines functions HilbertWithFT

#' A function rather aimed at developers
#' @noRd

HilbertWithFT = function(absorptionIn){

  ### get time domain
  at=stats::fft(absorptionIn)
  mm=sqrt(Re(at)**2+Im(at)**2)
  at[1]=complex(real=max(mm),imaginary=0)
  ### now, change all signs of imaginary
  at=complex(real=Re(at), imaginary=-Im(at))
  #### now, get freq data
  af=stats::fft(at)
  ### a complex vector containing both absorption and dispersion,
  ### to get the same scale as input
  af = af/length(absorptionIn)

  return(af)
}

Try the NMRphasing package in your browser

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

NMRphasing documentation built on Oct. 13, 2024, 1:07 a.m.