mioXpektron.denoise.denoise_batch
Batch-oriented helpers for running denoising over many spectra files.
Functions
|
Apply the configured denoising method to multiple spectrum files. |
|
Parse a plain-text spectrum file into NumPy arrays using Polars. |
|
Persist a spectrum to disk with the same column ordering as the input using Polars. |
Classes
|
Outcome metadata for a single denoising file run. |
- mioXpektron.denoise.denoise_batch.load_txt_spectrum(path)[source]
Parse a plain-text spectrum file into NumPy arrays using Polars.
- Parameters:
path (Path) – Location of the ASCII export produced by the instrument or pre-processing software. Delimiters can be comma, tab, semicolon, or space.
- Returns:
Dictionary containing any detected columns (channel, mz, and intensity). Only columns that successfully parse are included; the intensity array is always provided.
- Return type:
Notes
The loader uses Polars for fast CSV parsing with automatic delimiter detection, tolerates blank lines, and skips rows that fail numeric conversion.
- mioXpektron.denoise.denoise_batch.save_txt_spectrum(orig, out_path, arrays)[source]
Persist a spectrum to disk with the same column ordering as the input using Polars.
- Parameters:
orig (Path) – Original source file. Currently unused but kept for potential metadata handling.
out_path (Path) – Destination path for the denoised export.
arrays (dict[str, np.ndarray]) – Columns to write. The function writes whichever of channel, mz, and intensity are present, preserving numeric precision to six decimals.
- Return type:
None
- class mioXpektron.denoise.denoise_batch.BatchResult(file, out_file, status, elapsed_s, n_points, message='')[source]
Bases:
objectOutcome metadata for a single denoising file run.
- Parameters:
- mioXpektron.denoise.denoise_batch.batch_denoise(files, output_dir, method='wavelet', n_workers=0, backend='threads', progress=True, params=None)[source]
Apply the configured denoising method to multiple spectrum files.
- Parameters:
files (Iterable[str | Path]) – Collection of filesystem paths (glob results, manual list, etc.).
output_dir (str | Path) – Directory where the denoised outputs will be written.
method (str, default "wavelet") – Name of the smoothing routine forwarded to
noise_filtering().n_workers (int, default 0) – Worker count for the executor.
0orNoneselects a CPU-aware default.backend ({"threads", "processes"}, default "threads") – Execution strategy for the worker pool.
progress (bool, default True) – If True, wrap the executor iterator in
tqdmwhen available.params (dict | None) – Extra keyword arguments forwarded to
noise_filtering().
- Returns:
Status records describing each attempted file.
- Return type:
- Raises:
ValueError – If no input paths exist or an unsupported backend name is provided.