Overview
Metbit — Python API
Preprocess spectra, build PCA/OPLS-DA models, and visualize results with clean, high‑level functions.
Install with
pip install metbit
and jump into a typical workflow below.Key Features
Data Processing
Baseline, calibration, normalization, preprocessing.
Typical Workflow
- Preprocess your spectra (optional)
- Fit an OPLS‑DA model
- Assess VIP and visualize results
import pandas as pd
from metbit.nmr_preprocess import nmr_preprocessing
from metbit.metbit import opls_da
prep = nmr_preprocessing(...)
X, y = prep.X, prep.y
model = opls_da(
X, y,
features_name=list(X.columns), n_components=2,
scaling_method='pareto', kfold=3,
estimator='opls', random_state=94, auto_ncomp=True
)
model.fit()
vip_fig = model.vip_plot(threshold=1.0)
vip_fig.show()