Installation
phspectra is a Python library for decomposing 1-D astronomical spectra into Gaussian components using 0-dimensional persistent homology for peak detection. Instead of derivative-based methods (GaussPy) or brute-force parameter sweeps, it ranks peaks by their topological persistence and uses a single parameter () to threshold noise from real structure.
Requirements
- Python >= 3.11
- NumPy >= 1.26
- SciPy >= 1.12
Install from PyPI
pip install phspectra
An optional C extension (_gaussfit) is compiled automatically from source when building from a checkout that includes src/phspectra/_gaussfit.c. If compilation fails, the library falls back to SciPy's curve_fit transparently.
Publishing
The package is published to PyPI via python-semantic-release. On every merge to main, the release pipeline:
- Parses conventional commits scoped to
packages/phspectra/. - Bumps the version in
pyproject.tomland__init__.py. - Tags the release as
phspectra-v{version}. - Builds an sdist + wheel with
python -m build. - Publishes to PyPI via trusted publishing (OIDC, no API tokens).