You are viewing the documentation for metbit 9.0.0. Change release context
metbit.preprocessing.baseline
Baseline correction utilities for 1D NMR spectra.
import metbit.preprocessing.baselineFunctions
baseline_correct(X: pd.DataFrame, method: Literal['asls', 'arpls', 'airpls', 'modpoly', 'imodpoly', 'rubberband']='asls', x: Optional[np.ndarray]=None, return_baseline: bool=False, **kwargs: Any)
Apply baseline correction across spectra in a DataFrame.
Parameters
Xpd.DataFrameRows are spectra; columns are ppm (x-axis) values.
methodstrOne of'asls', 'arpls', 'airpls', 'modpoly', 'imodpoly', 'rubberband'.xnp.ndarray, optionalExplicit x-axis to use (same length as columns). If None, tries to infer from `X.columns` by casting to float, else uses index positions.
return_baselineboolIf True, also return a DataFrame of the estimated baselines. **kwargs : Any Algorithm-specific keyword arguments (e.g., lam, p, max_iter, poly_order, ...).
Returns
correctedpd.DataFrameBaseline-corrected spectra.
baseline_dfpd.DataFrame (optional)Estimated baselines (returned if return_baseline=True).
bline(X: pd.DataFrame, lam: float=10000000.0, max_iter: int=30)
Backwards-compatible wrapper for ALS baseline correction.
Parameters
Xpd.DataFrameRows are spectra; columns are ppm values.
lamfloatSmoothing parameter for ASLS.
max_iterintMax iterations for ASLS.