| Crates.io | andam |
| lib.rs | andam |
| version | 0.1.2 |
| created_at | 2026-01-18 03:22:41.231126+00 |
| updated_at | 2026-01-18 03:55:30.646141+00 |
| description | A comprehensive Rust library for cosmological calculations, visualizations and simulations |
| homepage | https://github.com/cosmos-andam/andam |
| repository | https://github.com/cosmos-andam/andam |
| max_upload_size | |
| id | 2051700 |
| size | 274,124 |
A comprehensive Rust library for cosmological calculations and visualizations.
Andam (அண்டம்) means "universe" in தமிழ் (Tamil).
use andam::dynamics::Universe;
use andam::observations::luminosity_distance;
use andam::statistics::mcmc::*;
fn main() {
// Basic cosmology
let universe = Universe::benchmark();
println!("Universe age: {:.2} Gyr", universe.age_today());
let distance = luminosity_distance(1.0, &universe);
println!("Distance to z=1: {:.0} Mpc", distance);
// MCMC parameter estimation
let params = vec![
Parameter {
name: "Omega_m".to_string(),
initial: 0.3,
min: 0.2,
max: 0.4,
proposal_width: 0.01,
},
];
let log_likelihood = |theta: &[f64]| {
-0.5 * (theta[0] - 0.315).powi(2) / 0.01_f64.powi(2)
};
let sampler = MCMCSampler::new(params, log_likelihood, 50, 1000);
let chain = sampler.run(200);
println!("Omega_m = {:.4} ± {:.4}",
chain.mean("Omega_m").unwrap(),
chain.std("Omega_m").unwrap());
}
# Default installation (includes plotting)
cargo add andam
# With static image export (requires network during build)
cargo add andam --features plotting-kaleido
# With HDF5 storage support (requires HDF5 1.12 or earlier)
cargo add andam --features hdf5-storage
# Minimal installation (no plotting or HDF5)
cargo add andam --no-default-features
# Everything (includes kaleido)
cargo add andam --features full
[dependencies]
# Default (with plotting)
andam = "0.1.1"
# With HDF5 storage
andam = { version = "0.1.1", features = ["hdf5-storage"] }
# Minimal
andam = { version = "0.1.1", default-features = false }
# All features
andam = { version = "0.1.1", features = ["full"] }
git clone https://github.com/cosmos-andam/andam
cd andam
cargo build --release
cargo test
| Feature | Description | Default | Dependencies |
|---|---|---|---|
plotting |
Visualization with plotly and plotters | Yes | plotly, plotters |
plotting-kaleido |
Add static image export (requires network during build) | No | plotly/kaleido |
hdf5-storage |
HDF5 data storage and retrieval | No | hdf5, flate2, chrono |
full |
All features enabled | No | All of the above |
HDF5 Storage:
--features hdf5-storageKaleido (Static Image Export):
--features plotting-kaleidoGenerate API docs: cargo doc --open
Run built-in examples:
cargo run --example hubble_diagram
cargo run --example universe_evolution
cargo run --example distance_measures
cargo run --example cmb_power_spectrum
cargo run --example matter_power_spectrum
cargo run --example structure_growth
cargo run --example bbn_evolution
cargo run --example power_spectrum_comparison
cargo run --example halo_mass_function
cargo run --example density_slice
cargo run --example corner_plot
cargo run --example polarization_spectrum
cargo run --example model_comparison
Total: 15 examples covering all 9 implementation phases.
See examples/ directory for complete demonstration programs.
cargo test # Run all tests (60 tests)
cargo test --lib # Unit tests only
cargo check --examples # Verify examples compile
Status: All 60 tests passing
andam/
src/
constants.rs # Physical constants
units.rs # Unit conversions
dynamics/ # Universe evolution (Friedmann)
observations/ # Distance measures
cmb/ # CMB physics & polarization
structure/ # Power spectra, halos, cosmic web
perturbations/ # Growth theory
advanced/ # Weak lensing
early_universe/ # BBN, freeze-out
statistics/ # MCMC, Fisher matrices (NEW)
beyond_lcdm/ # Dark energy, neutrinos (NEW)
visualization/ # Plotting tools
examples/ # 15 demo programs
tests/ # Integration tests
docs/ # Documentation
Validated against:
Key results:
Implemented (Phases 1-9):
Coverage: ~90-95% of graduate-level cosmology textbooks
| Module | Features | Tests |
|---|---|---|
dynamics |
Friedmann solver, components | 5 |
observations |
Distances, ages | 4 |
cmb |
Recombination, power, polarization | 7 |
structure |
P(k), halos, correlation, cosmic web | 12 |
perturbations |
Growth factors, Boltzmann | 4 |
advanced |
Weak lensing, convergence | 3 |
early_universe |
BBN, freeze-out | 6 |
statistics |
MCMC, Fisher | 3 |
beyond_lcdm |
Dark energy, neutrinos | 5 |
storage |
HDF5 data storage (optional) | 6 |
visualization |
Plotting (optional, default) | - |
units |
Conversions | 3 |
constants |
Physical constants | 3 |
Total: 66 tests passing
Contributions welcome! See CONTRIBUTING.md.
Areas of interest:
Completed:
Future (Optional Enhancements):
Licensed under either:
at your option.
@software{andam,
title = {Andam: A Comprehensive Cosmology Library in Rust},
author = {Cosmos Andam Contributors},
year = {2026},
url = {https://github.com/cosmos-andam/andam},
note = {Phases 1-9 complete: Core cosmology, BBN, structure formation,
statistical inference, CMB polarization, and beyond-ΛCDM models}
}
Status: Version 0.1.1 | 60 tests passing | 15 examples | Phases 1-9 complete | Production-ready