LIBS (Laser-Induced Breakdown Spectroscopy) data analysis toolkit for spectral peak finding, Voigt profile fitting, elemental indexing, and PCA-based peak-shape decomposition.
pip install -e .This installs alibz as an editable package with all dependencies (numpy, scipy, scikit-learn, scikit-optimize, matplotlib, pulp).
For GPU acceleration (optional):
pip install -e ".[gpu]"| Module | Description |
|---|---|
alibz.peaky_finder |
Peak detection, FFT background removal, multi-Voigt fitting |
alibz.peaky_indexer_v3 |
Whole-pattern spectral indexer (Bayesian optimisation + NNLS); the only supported indexer |
alibz.peaky_maker |
Forward spectral synthesis via Saha-Boltzmann |
alibz.peaky_corpus |
Batch loading, standardisation, parallel fitting, width statistics |
alibz.peaky_pca |
PCA peak-shape decomposition and broadening classification |
alibz.background_pca |
Corpus-level PCA for detector artifact and baseline removal |
alibz.detector |
Three-segment detector model: junction detection, artifact removal, segmented background subtraction |
alibz.utils |
Physical constants, Voigt utilities, NIST database interface, Saha-Boltzmann solver |
alibz.peaky_indexer_v3 is the only indexer module. PeakyFitter has been removed.
from alibz import PeakyFinder, PeakyIndexer
# Load data and fit peaks
finder = PeakyFinder("path/to/raw/data")
fit_dict = finder.fit_spectrum_data(0, n_sigma=1, plot=False)
# Whole-pattern indexing
indexer = PeakyIndexer(fit_dict["sorted_parameter_array"])
result = indexer.run(shift_tolerance=0.1, max_ion_stage=2, n_calls=20, verbose=False)
print(result.temperature, result.ne) # plasma T and log10(ne)
print(result.concentrations) # per-species concentrationsThe indexer returns a FitResult dataclass with temperature, electron density,
per-species concentrations, residuals, R-squared, and peak assignments.
run-corpus-pca /path/to/libs/data \
--pattern '**/*AverageSpectrum.csv' \
--n-components 5 \
--workers 4 \
--timeout 120 \
--fit-checkpoint data/fits.pkl \
--out data/results.pklbackground-pca /path/to/libs/data \
--n-components 20 \
--batch-size 200 \
--out data/bg_pca.pklBoth commands accept --gpu / --no-gpu flags and support multiple input directories.
notebooks/peaky_demo_v1.ipynb-- Peak finding, fitting, and elemental indexing workflownotebooks/peaky_data.ipynb-- Corpus-level PCA, peak width statistics, peak-shape decomposition, and PC-based peak characterisationnotebooks/peaky_syndexer.ipynb-- End-to-end synthetic spectrum generation, fitting, and indexing stress testsnotebooks/peaky_analyzer.ipynb-- Interactive peak-shape and PCA analysis scratchpadnotebooks/peaky_tester.ipynb-- Interactive exploratory testing notebook
pip install -e ".[dev]"
pytest tests/Unlicense (public domain)