Aligns rows of an NMR spectral matrix to a reference spectrum by maximizing cross-correlation. Optionally uses the row-wise median spectrum as reference. Useful for minor spectral misalignments.
Arguments
- seg
Numeric matrix. Each row is a 1D NMR spectrum segment.
- idx_ref
Integer. Row index to use as reference spectrum. Ignored if
med = TRUE
.- clim
Numeric. Minimum cross-correlation threshold. Segments with lower similarity are not shifted.
- med
Logical. If
TRUE
, the row-wise median spectrum is used as the reference.- norm
Logical. If
TRUE
, rows are scaled to the[0, 1]
range using min-max scaling before alignment.
Value
A numeric matrix of aligned spectra with the same dimensions as seg
.
If med = TRUE
, the output excludes the median row.
Details
Each spectrum is aligned to the reference by computing the cross-correlation and applying a lag-based circular shift.
The shift is applied only if the cross-correlation exceeds clim
.
This function is intended for fine-tuning alignment across short ppm windows (i.e., segments).
See also
Other NMR:
binning()
,
cvanova()
,
get_idx()
,
lw()
,
matspec()
,
noise.est()
,
normErectic()
,
read1d()
,
read1d_raw()
,
stocsy1d_metabom8-class
,
storm()