This function normalizes 1D NMR spectra using the ERETIC reference signal. If integr = TRUE
, it returns the ERETIC integral only. The reference region is inferred automatically based on the observed ERETIC peak (around 12 ppm for urine or 15 ppm for plasma).
Value
If
integr = TRUE
: numeric vector of ERETIC integrals per spectrum.If
integr = FALSE
: numeric matrix of spectra normalized by ERETIC integral.
Details
The function identifies the dominant ERETIC peak within the range 10–16 ppm and then uses a narrow window around 12 ppm (urine) or 15 ppm (plasma) to compute the normalization factor.
See also
Other NMR:
alignSegment()
,
binning()
,
cvanova()
,
get_idx()
,
lw()
,
matspec()
,
noise.est()
,
read1d()
,
read1d_raw()
,
stocsy1d_metabom8-class
,
storm()
Examples
set.seed(123)
n <- 1000
ppm <- seq(0, 14, length.out = n)
gauss <- function(x, c, h, w=0.05) h * exp(-((x - c)^2) / (2 * w^2))
heights <- c(100, 80, 60, 40, 20)
spectra <- sapply(heights, function(h) rnorm(n, 0, 0.01) + gauss(ppm, 12, h))
spectra <- t(spectra) # 5 spectra x 1000 points
colnames(spectra) = ppm
matspec(spectra, ppm, shift=c(11, 13))
X_norm = normErectic(spectra)
matspec(X_norm, ppm, shift=c(11, 13))