/
You are viewing the documentation for metbit 9.0.0. Change release context

metbit.nmr.alignment

Automated NMR peak alignment with basic multiplet detection.

import metbit.nmr.alignment

Classes

Multiplet

PeakAligner

High-level helper to detect multiplets and align spectra around them.

Typical use: pa = PeakAligner(spectra, ppm, sf_mhz=600) windows, mptable = pa.auto_windows(top_n=30) X_aligned, shifts = pa.align(windows)

Methods

__init__(self, spectra: pd.DataFrame, ppm: np.ndarray, sf_mhz: float)
auto_windows(self, top_n: int=30, max_group_width_ppm: float=0.03)

Generate non-overlapping windows centered on strongest multiplets of the median spectrum.

align(self, windows: List[Tuple[float, float]], reference: str='median', max_shift_ppm: float=0.02)

Functions

detect_multiplets(spectrum: pd.Series, ppm: np.ndarray, sf_mhz: float, smooth_window: int=11, smooth_poly: int=2, prominence: float=0.01, width: int=3, max_group_width_ppm: float=0.03)

Detect and classify multiplets on a single spectrum.

Parameters - spectrum: 1D intensities indexed like ppm - ppm: ppm axis as float array, same length as spectrum - sf_mhz: spectrometer frequency in MHz (e.g., 600 for 600 MHz) - smooth_window, smooth_poly: Savitzky-Golay smoothing params - prominence, width: find_peaks parameters (tune to data scale) - max_group_width_ppm: group peaks within this span as a multiplet

icoshift_align(spectra: pd.DataFrame, ppm: np.ndarray, windows: List[Tuple[float, float]], reference: str='median', max_shift_ppm: float=0.02)

Interval-correlation optimized shifting (icoshift-like).

Parameters - spectra: rows=spectra, cols=ppm - ppm: ppm vector matching columns (ascending or descending OK) - windows: list of (ppm_min, ppm_max) intervals to align independently - reference: 'median' or 'mean' for the reference spectrum - max_shift_ppm: max allowed shift magnitude within each window

Returns - aligned spectra (DataFrame) - per-sample list of applied integer-point shifts for each window

Source

metbit/nmr/alignment.py at v9.0.0
Project downloadsPyPI and GitHub measure different distribution channels. Statistics refresh daily.

Counts are distribution activity, not unique users. GitHub source archives and Git clones are not included. Sources: PyPI Stats, Pepy, ClickPy, and GitHub Releases.

metbit 9.0.0 documentation