Lightcurve fitting library for astronomical transients, written in Rust.
Provides three complementary fitters that operate on multi-band photometry (ZTF g/r/i):
| Fitter | Input | Method | Key outputs |
|---|---|---|---|
| Nonparametric | magnitudes | Gaussian-process interpolation | peak mag, t0, rise/decay timescales, FWHM, GP derivatives, von Neumann ratio, power-law decay index |
| Parametric | fluxes | PSO model selection → SVI or Laplace uncertainty | best-fit model (Bazin, Villar, TDE, Arnett, Magnetar, …), posterior means & uncertainties |
| Thermal | magnitudes | Blackbody color fitting via PSO | log temperature at peak, cooling rate |
use lightcurve_fitting::{
build_mag_bands, build_flux_bands,
fit_nonparametric, fit_parametric, fit_thermal,
UncertaintyMethod,
};
// times, mags, mag_errs, bands: parallel Vecs from your photometry table
let mag_bands = build_mag_bands(×, &mags, &mag_errs, &bands);
let flux_bands = build_flux_bands(×, &mags, &mag_errs, &bands);
let (np_results, trained_gps) = fit_nonparametric(&mag_bands);
let p_results = fit_parametric(&flux_bands, false, UncertaintyMethod::Laplace);
let t_result = fit_thermal(&mag_bands, Some(&trained_gps));When built with --features cuda, the parametric fitter uses CUDA batch PSO
to fit all sources simultaneously on a GPU. This provides significant speedup
at scale (see Benchmarks).
cargo build --release --features cudaRequires CUDA toolkit (tested with 12.x). The build system auto-detects
nvcc via the CUDA_PATH environment variable or standard locations.
cargo build --releaseRun the unit and integration tests:
cargo testRun GPU-specific tests (requires CUDA):
cargo test --features cuda --test test_gpu -- --nocaptureThroughput benchmarks measure scaling across two axes:
- Source-count scaling: fixed 30 pts/band, 10–1,000 sources
- Point-count scaling: fixed 100 sources, 10–500 pts/band
Run the full benchmark suite:
# With GPU
cargo test --release --features cuda --test bench_throughput -- --ignored --nocapture
# CPU only
cargo test --release --test bench_throughput -- --ignored --nocapture
# Generate plots
python3 benchmarks/plot_throughput.py
# Submit as SLURM job
sbatch benchmarks/run_bench.shResults are written to benchmarks/throughput_results.csv.
See docs/benchmarks.md for full methodology and results.
Two GitHub Actions workflows are included:
- test.yml — runs
cargo teston every push tomainand on PRs. - throughput.yml — builds in release mode, runs the throughput benchmark, uploads
wall_time.txtas an artifact, and on PRs compares against themainbaseline. Fails if wall time regresses by more than 10%.
GPL-3.0