A library for fitting and analyzing asteroid phase curves.
Project description
pySPAC: Solar Phase curve Analysis and Characterization
pySPAC (python Solar Phase curve Analysis and Characterization) is a library for analyzing and fitting astronomical phase curves of asteroids and other small solar system bodies. It provides an object-oriented interface to bridge observational photometric data with standard theoretical models.
The primary function of pySPAC is to determine the absolute magnitude (H) and other phase function parameters from a set of phase angle (α) and reduced magnitude observations.
Documentation
📖 Full documentation is available at: https://rcboufleur.github.io/pySPAC/
Features
- Object-oriented interface via the PhaseCurve class
- Standard IAU photometric models: (H, G), (H, G₁, G₂), (H, G₁₂), (H, G₁₂) Penttilä calibration, and linear fit
- Weighted least-squares fitting with observational uncertainties
- Monte Carlo uncertainty analysis
- Multiple optimization methods with automatic constraint validation
- Model generation from fitted parameters
- Data persistence - save and load object state to/from JSON
- Comprehensive error handling and validation
Installation
From PyPI
pip install pyspac
From GitHub
pip install git+https://github.com/rcboufleur/pySPAC.git
Quick Start
import numpy as np
from pyspac import PhaseCurve
# Observational data
angles = np.array([0.17, 0.63, 0.98, 1.62, 4.95, 9.78,
12.94, 13.27, 13.81, 17.16, 18.52, 19.4])
mags = np.array([6.911, 7.014, 7.052, 7.105, 7.235, 7.341,
7.425, 7.427, 7.437, 7.511, 7.551, 7.599])
errors = np.array([0.02, 0.02, 0.03, 0.03, 0.04, 0.04,
0.02, 0.02, 0.03, 0.03, 0.04, 0.04])
# Create object and fit model
pc = PhaseCurve(angle=angles, magnitude=mags, magnitude_unc=errors)
pc.fitModel(model="HG", method="trust-constr")
pc.summary()
# Monte Carlo uncertainties
pc.monteCarloUncertainty(n_simulations=500, model="HG", method="trust-constr")
pc.summary()
For detailed examples and tutorials, see the full documentation.
Available Models
| Model | Parameters | Description |
|---|---|---|
| LINEAR | H, β | Linear phase function |
| HG | H, G | IAU standard (H, G) system |
| HG12 | H, G₁₂ | Simplified (H, G₁₂) system |
| HG12PEN | H, G₁₂ | Penttilä et al. (2016) calibration |
| HG1G2 | H, G₁, G₂ | Three-parameter (H, G₁, G₂) system |
Model-Method Compatibility
- Constrained models (HG, HG12, HG12PEN, HG1G2): Must use
trust-constr,SLSQP, orCOBYLA - Unconstrained models (LINEAR): Can use any optimization method
pySPAC automatically validates model-method compatibility and provides clear error messages.
Monte Carlo Uncertainty Analysis
Two Monte Carlo methods for different scientific cases:
.monteCarloUncertainty(): Based on observational uncertainties.monteCarloUnknownRotation(): Includes rotational scatter modeling
Data Requirements
| Model | Min Points | Recommended |
|---|---|---|
| All 2-parameter models | 3 | 5+ |
| HG1G2 (3-parameter) | 3* | 5+ |
*Due to mathematical constraint 1-G₁-G₂=0
Contributing
Contributions are welcome! Please:
- Fork the repository on GitHub
- Create a new branch for your feature or bug fix
- Make your changes and commit them
- Submit a pull request to the main branch
Feel free to open an issue to report bugs or suggest new features.
References
If you use pySPAC in your research, please cite this repository and the relevant papers for the models you employ:
- HG System: Bowell, E., et al. (1989). "Application of photometric models to asteroids." In Asteroids II (pp. 524-556).
- HG1G2 & HG12 Systems: Muinonen, K., et al. (2010). "A three-parameter magnitude phase function for asteroids." Icarus, 209(2), 542-555.
- HG12PEN System: Penttilä, A., et al. (2016). "Asteroid H, G1, G2 and H, G12 phase function performance with sparse data." Planetary and Space Science, 123, 117-122.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyspac-0.1.0.tar.gz.
File metadata
- Download URL: pyspac-0.1.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b098abb5c13cfd27cdcbd809afe5c3f426f73d1d1bd6fe102f7b5903488fc35
|
|
| MD5 |
8d3d573c3e03e2503188f04b98da8e14
|
|
| BLAKE2b-256 |
d3524147bea18e18c75a1d88233680de072892474d0dcbf0c48ac22fca6c15e6
|
File details
Details for the file pyspac-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyspac-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb78e4ebc0f4f6739e6c137ea0d39395021f95873f6fb990366d94650c829a1b
|
|
| MD5 |
3babbfd1e5338396cdd242251dc1adb1
|
|
| BLAKE2b-256 |
606c16f6ae0f8918cd179c2f804108c5cd57bb44c9a695cbdcdc97bb95a2b304
|