mioXpektron.recalibrate
Recalibration utilities for the Xpektron toolkit.
- class mioXpektron.recalibrate.FlexibleCalibrator(config=None)[source]
Bases:
objectSingle-model calibrator with user-selected method.
Unlike
AutoCalibrator, this calibrator fits exactly one model and provides more control over outlier rejection, quality thresholds, and per-model parameters.- Parameters:
config (FlexibleCalibConfig | None)
- class mioXpektron.recalibrate.FlexibleCalibConfig(reference_masses, calibration_method='quad_sqrt', output_folder='calibrated_spectra', output_mz_range=None, max_workers=None, autodetect_tol_da=None, autodetect_tol_ppm=None, autodetect_method='gaussian', autodetect_fallback_policy='max', autodetect_strategy='mz', prefer_recompute_from_channel=False, outlier_threshold=3.0, use_outlier_rejection=True, max_iterations=3, min_calibrants=3, max_ppm_threshold=100.0, fail_on_high_error=False, retry_high_error_with_pruning=False, retry_high_error_with_mz_fallback=False, retry_high_error_max_removals=5, exclude_reference_masses=<factory>, auto_screen_reference_masses=False, screen_max_mean_abs_ppm=50.0, screen_max_median_abs_ppm=None, screen_min_valid_fraction=0.8, screen_min_count=3, screen_exclude_below_mz=1.5, spline_smoothing=None, multisegment_breakpoints=<factory>, instrument_params=<factory>, save_diagnostic_plots=False, verbose=True, auto_tune=False)[source]
Bases:
objectConfiguration for flexible calibration with a single user-selected method.
- Parameters:
calibration_method (Literal['quad_sqrt', 'linear_sqrt', 'poly2', 'reflectron', 'multisegment', 'spline', 'physical'])
output_folder (str)
max_workers (int | None)
autodetect_tol_ppm (float | None)
autodetect_method (str)
autodetect_fallback_policy (str)
autodetect_strategy (str)
prefer_recompute_from_channel (bool)
outlier_threshold (float)
use_outlier_rejection (bool)
max_iterations (int)
min_calibrants (int)
max_ppm_threshold (float | None)
fail_on_high_error (bool)
retry_high_error_with_pruning (bool)
retry_high_error_with_mz_fallback (bool)
retry_high_error_max_removals (int)
auto_screen_reference_masses (bool)
screen_max_mean_abs_ppm (float)
screen_max_median_abs_ppm (float | None)
screen_min_valid_fraction (float)
screen_min_count (int)
screen_exclude_below_mz (float)
spline_smoothing (float | None)
save_diagnostic_plots (bool)
verbose (bool)
auto_tune (bool)
- class mioXpektron.recalibrate.AutoCalibrator(config=None)[source]
Bases:
objectAutomatic multi-model calibrator.
Fits all requested models, selects the best one per file, and writes calibrated spectra.
- Parameters:
config (AutoCalibConfig | None)
- class mioXpektron.recalibrate.AutoCalibConfig(reference_masses, output_folder='calibrated_spectra', max_workers=None, autodetect_tol_da=None, autodetect_tol_ppm=None, autodetect_method='gaussian', autodetect_fallback_policy='max', autodetect_strategy='mz', prefer_recompute_from_channel=False, outlier_threshold=3.0, use_outlier_rejection=True, max_iterations=3, model=None, models_to_try=None, prefer_physical_models=True, min_calibrants=3, max_ppm_warning=100.0, max_ppm_error=500.0, use_bootstrap_init=True, spline_smoothing=None, multisegment_breakpoints=<factory>, instrument_params=<factory>)[source]
Bases:
objectUniversal calibration configuration with robust options.
- Parameters:
reference_masses (list of float) – Known calibrant ion masses (m/z).
model (str, optional) – Convenience shortcut — a single model name (or common alias like
'quadratic','tof','linear'). Resolved into models_to_try during__post_init__. Ignored when models_to_try is explicitly provided.models_to_try (list of str, optional) – Explicit list of model names to fit. Default: all production-ready models (excludes experimental ones such as
multisegmentandphysical).output_folder (str)
max_workers (int | None)
autodetect_tol_da (float | None)
autodetect_tol_ppm (float | None)
autodetect_method (str)
autodetect_fallback_policy (str)
autodetect_strategy (str)
prefer_recompute_from_channel (bool)
outlier_threshold (float)
use_outlier_rejection (bool)
max_iterations (int)
prefer_physical_models (bool)
min_calibrants (int)
max_ppm_warning (float)
max_ppm_error (float)
use_bootstrap_init (bool)
spline_smoothing (float | None)
- class mioXpektron.recalibrate.FlexibleCalibratorDebug(config=None)[source]
Bases:
FlexibleCalibratorDebug variant of
FlexibleCalibratorwith verbose peak-picking.Inherits all calibration logic and overrides only
_autodetect_channelsto route through the diagnostic versions of_enhanced_pick_channelsand_parabolic_peak_center.- Parameters:
config (FlexibleCalibConfig | None)
- mioXpektron.recalibrate.FlexibleCalibConfigDebug
alias of
FlexibleCalibConfig
Modules
AutoCalibrator — automatic multi-model calibration for mass spectrometry. |
|
FlexibleCalibrator — single-model calibration with user-selected method. |
|
Debug version of FlexibleCalibrator with diagnostic logging. |
|
peak_picker.py Identify the most intense point within ±0.5 Da of eight reference m/z values in every calibrated ToF-SIMS spectrum and return the results as a nested Python dictionary. |
|
peak_picker.py Identify the most intense point within ±0.5 Da of eight reference m/z values in every calibrated ToF-SIMS spectrum and return the results as a nested Python dictionary. |
|
Test script to demonstrate the diagnostic logging in flexible_calibrator_debug.py |