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

metbit.metbit_nmr.nmr_preprocess

NMR and preprocessing module in metbit 7.3.17.

import metbit.metbit_nmr.nmr_preprocess

Classes

nmr_preprocessing

A class for preprocessing NMR data. This class handles the following preprocessing steps: 1. Reading FID files 2. Zero-filling 3. Fourier Transform 4. Phasing 5. Baseline correction 6. Calibration 7. Data storage in a pandas DataFrame 8. Data visualization 9. Data export

Parameters:

data_pathstr

Path to the directory containing FID files.

bin_sizefloat

Size of the bins for zero-filling (default: 0.0003).

auto_phasingbool

If True, automatic phasing is applied (default: True).

fn_str

Function name for phasing (default: 'acme').

baseline_correctionbool

If True, baseline correction is applied (default: True).

baseline_typestr

Type of baseline correction to apply (default: 'linear').

Options'corrector', 'constant', 'explicit', 'median', 'solvent filter'.
calibrationbool

If True, calibration is applied (default: True).

calib_typestr

Type of calibration to apply (default: 'tsp').

Options'tsp', 'acetate', 'glucose', 'alanine', 'formate'.
custom_rangetuple

Optional (start, end) PPM range for custom calibration.

export_pathstr

Path to save the processed data (default: None).

export_formatstr

Format to save the processed data (default: 'csv').

export_namestr

Name of the exported file (default: 'processed_nmr_data').

Attributes:

nmr_datapd.DataFrame

Processed NMR data.

ppmnp.ndarray

PPM scale.

dic_arraydict

Dictionary containing metadata from the FID files.

phase_datapd.DataFrame

DataFrame containing phase information.

Methods:

get_data() : pd.DataFrame Returns the processed NMR data. get_ppm() : np.ndarray Returns the PPM scale. get_metadata() : dict Returns the metadata from the FID files. get_phase() : pd.DataFrame Returns the phase information. plot_data() : None Plots the processed NMR data. export_data() : None Exports the processed NMR data to a specified format.

Example:

>>> fid = 'dev/launch/data/test_nmr_data' >>> nmr = nmr_preprocessing(fid, bin_size=0.0005, auto_phasing=False, fn_='acme', baseline_correction=True, baseline_type='corrector', calibration=True, calib_type='glucose') >>> data = nmr.get_data() >>> ppm = nmr.get_ppm() >>> metadata = nmr.get_metadata()

Methods

__init__(self, data_path: str, bin_size: float=0.0003, auto_phasing: bool=True, fn_='acme', baseline_correction: bool=True, baseline_type: str='linear', calibration: bool=True, calib_type: str='tsp')
get_data(self)
get_ppm(self)
get_metadata(self)
get_phase(self)

Functions

read_fid(data_path: str)
remove_digital_filter(dic, data)
generate_ppm_scale(dic, data)
phasing(data, index, auto=True, fn='peak_minima', p0=0.0, p1=0.0)

Source

metbit/metbit_nmr/nmr_preprocess.py at v7.3.17
Downloads for metbit 7.3.17PyPI 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 7.3.17 documentation