Preprocess spectra, build PCA/OPLS-DA models, and visualize results.
Install from PyPI and jump into processing, modeling, and visualization.
Install & Quick StartBrowse API
Preprocess, normalize and prepare spectra.
Fit PCA/OPLS-DA models, cross-validate and compute VIP scores.
Generate plots, STOCSY and interactive UIs.
pip install metbit
from metbit.nmr_preprocess import nmr_preprocessing
# Path to a Bruker project folder containing sample subfolders with 'fid'
fid_dir = 'path/to/bruker_project'
# 1) Preprocess NMR data (bin, FFT, phasing, optional baseline + calibration)
nmr = nmr_preprocessing(
fid_dir,
bin_size=0.0005,
auto_phasing=True,
baseline_correction=True,
baseline_type='corrector',
calibration=True,
calib_type='tsp',
)
# 2) Get processed matrix and ppm axis
X = nmr.get_data() # pandas.DataFrame (samples x ppm)
ppm = nmr.get_ppm() # numpy.ndarray
print(X.shape, ppm[:5])