mioXpektron.normalization.main
High-level orchestration helpers for normalising ToF-SIMS spectra.
Classes
|
Evaluate and apply normalization strategies for ToF-SIMS data. |
- class mioXpektron.normalization.main.NormalizationMethods(mz_values, raw_intensities)[source]
Bases:
objectEvaluate and apply normalization strategies for ToF-SIMS data.
- Parameters:
mz_values (array-like) – The m/z axis shared by all spectra.
raw_intensities (array-like) – Raw intensity values aligned with
mz_values.
- apply(method='tic', **kwargs)[source]
Apply a named normalization to the stored spectrum.
- Parameters:
method (str) – Normalization method name (see
normalization_method_names()).**kwargs – Method-specific keyword arguments.
- Returns:
Normalized intensity array.
- Return type:
np.ndarray
- compare_visual(methods=None, method_kwargs_map=None, mz_min=0, mz_max=500, sample_name='test', group=None, figsize=(12, 8), save_plot=True)[source]
Plot the raw spectrum alongside several normalized versions.
- Parameters:
methods (list of str, optional) – Normalization methods to overlay. Defaults to a curated set.
method_kwargs_map (dict, optional) –
{method: {kwarg: value}}for method-specific parameters.mz_min (float) – m/z bounds for the preview window.
mz_max (float) – m/z bounds for the preview window.
sample_name (str) – Label used for file naming.
group (str or None) – Group identifier.
figsize (tuple) – Figure size.
save_plot (bool) – Persist the rendered figure.
- Return type:
- normalize_and_check(method='tic', method_kwargs=None, *, sample_name='test', group=None, mz_min=0, mz_max=500, show_peaks=False, peak_height=1000, peak_prominence=50, min_peak_width=1, max_peak_width=None, figsize=(10, 6), save_plot=True)[source]
Apply one normalization and visualise the result with peak overlay.
- Parameters:
method (str) – Normalization method.
method_kwargs (dict, optional) – Extra kwargs forwarded to
normalize().sample_name (str) – Plot labels.
group (str) – Plot labels.
mz_min (float) – m/z window for the plot.
mz_max (float) – m/z window for the plot.
show_peaks (bool) – Annotate detected peaks.
peak_height (float) – Peak detection tuning passed to
PlotPeak.peak_prominence (float) – Peak detection tuning passed to
PlotPeak.min_peak_width (int) – Peak detection tuning passed to
PlotPeak.max_peak_width (int | None) – Peak detection tuning passed to
PlotPeak.figsize (tuple)
save_plot (bool)
- Return type:
- static evaluate(files, methods=None, method_kwargs_map=None, mz_min=None, mz_max=None, n_jobs=-1, compute_supervised=True, save_results=True)[source]
Evaluate normalization methods across multiple spectra files.
Thin wrapper around
NormalizationEvaluatorthat runs evaluation, prints a summary, and optionally saves results.- Parameters:
files (list of str or Path) – Spectrum file paths or glob patterns.
method_kwargs_map (dict, optional) – Per-method keyword arguments.
mz_min (float, optional) – m/z range for data import.
mz_max (float, optional) – m/z range for data import.
n_jobs (int) – Parallel workers (
-1= all CPUs).compute_supervised (bool) – Run supervised classification (requires scikit-learn).
save_results (bool) – Save CSV + JSON + plots to
OUTPUT_DIR.
- Returns:
The evaluator instance (call
.plot()for figures).- Return type: