gravitax 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gravitax-1.0.0/CHANGELOG.md +14 -0
- gravitax-1.0.0/CITATION.cff +294 -0
- gravitax-1.0.0/CONTRIBUTING.md +36 -0
- gravitax-1.0.0/LICENSE +21 -0
- gravitax-1.0.0/MANIFEST.in +6 -0
- gravitax-1.0.0/PKG-INFO +242 -0
- gravitax-1.0.0/README.md +192 -0
- gravitax-1.0.0/docs/api.md +181 -0
- gravitax-1.0.0/docs/citation.md +37 -0
- gravitax-1.0.0/docs/conf.py +37 -0
- gravitax-1.0.0/docs/contents.md +9 -0
- gravitax-1.0.0/docs/index.md +29 -0
- gravitax-1.0.0/docs/installation.md +48 -0
- gravitax-1.0.0/docs/quickstart.md +98 -0
- gravitax-1.0.0/docs/requirements.txt +4 -0
- gravitax-1.0.0/docs/settings.md +95 -0
- gravitax-1.0.0/examples/01_cmb_power_spectra.py +57 -0
- gravitax-1.0.0/examples/02_matter_power_and_sigma8.py +45 -0
- gravitax-1.0.0/examples/03_differentiable_gradient.py +99 -0
- gravitax-1.0.0/examples/README.md +21 -0
- gravitax-1.0.0/gravitax/__init__.py +105 -0
- gravitax-1.0.0/gravitax/_gradsolve_rodas5p_step.py +312 -0
- gravitax-1.0.0/gravitax/_nu_quadrature.py +208 -0
- gravitax-1.0.0/gravitax/_verbose.py +96 -0
- gravitax-1.0.0/gravitax/ap_imex.py +800 -0
- gravitax-1.0.0/gravitax/api.py +476 -0
- gravitax-1.0.0/gravitax/assembly.py +2627 -0
- gravitax-1.0.0/gravitax/background.py +412 -0
- gravitax-1.0.0/gravitax/block_solver.py +277 -0
- gravitax-1.0.0/gravitax/constants.py +147 -0
- gravitax-1.0.0/gravitax/data/__init__.py +32 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/grids/chi_box2s_N2000.npy +0 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/grids/chi_box2s_late4.npy +0 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/grids/chi_default.npy +0 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/grids/k_fine_box2s_N6000.npy +0 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/profiles/profile_tf5_late4.npz +0 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/accurate_cmb.env +26 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/accurate_massive_cmb.env +23 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/accurate_massive_pk.env +9 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/accurate_pk_grad.env +11 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/balanced.env +37 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/balanced_massive.env +26 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default.env +44 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_derivatives.env +51 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_derivatives_b1.env +54 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_derivatives_b512.env +54 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_massive.env +50 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_massive_derivatives.env +45 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_pk_derivatives.env +5 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_pk_large.env +15 -0
- gravitax-1.0.0/gravitax/data/gpu_settings/settings/default_pk_small.env +21 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/README.md +57 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/chi_E2.npy +0 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/highl5000.env +19 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/highl5000_nl.env +5 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/kf_p4_k07.npy +0 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/make_chi_reion.py +25 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/make_kfine_l5000.py +52 -0
- gravitax-1.0.0/gravitax/data/highl5000_preset/preset.json +30 -0
- gravitax-1.0.0/gravitax/data/reference_preset/box_grids.json +72 -0
- gravitax-1.0.0/gravitax/data/reference_preset/chi_box.npy +0 -0
- gravitax-1.0.0/gravitax/data/reference_preset/k_fine_box.npy +0 -0
- gravitax-1.0.0/gravitax/data/reference_preset/kernel_cost_profile.npz +0 -0
- gravitax-1.0.0/gravitax/data/reference_preset/preset.env +20 -0
- gravitax-1.0.0/gravitax/data/reference_preset/preset.json +64 -0
- gravitax-1.0.0/gravitax/data/reference_preset/preset_mnu.json +21 -0
- gravitax-1.0.0/gravitax/data/reference_preset/tols_panels149.npz +0 -0
- gravitax-1.0.0/gravitax/gpu/__init__.py +8 -0
- gravitax-1.0.0/gravitax/gpu/cosmo_pool.py +114 -0
- gravitax-1.0.0/gravitax/gpu/e2e_kernel.py +1397 -0
- gravitax-1.0.0/gravitax/gpu/highl.py +188 -0
- gravitax-1.0.0/gravitax/gpu/mnu_e2e.py +2226 -0
- gravitax-1.0.0/gravitax/gpu/mnu_two_launch.py +1078 -0
- gravitax-1.0.0/gravitax/gpu/pk_d1_problem.py +277 -0
- gravitax-1.0.0/gravitax/gpu/pk_lane.py +195 -0
- gravitax-1.0.0/gravitax/gpu/pk_p5.py +534 -0
- gravitax-1.0.0/gravitax/gpu/pk_p5_tan.py +184 -0
- gravitax-1.0.0/gravitax/gpu/pk_route.py +672 -0
- gravitax-1.0.0/gravitax/gpu/pk_speed.py +323 -0
- gravitax-1.0.0/gravitax/gpu/pre_pipeline.py +48 -0
- gravitax-1.0.0/gravitax/gpu/pre_tangents.py +698 -0
- gravitax-1.0.0/gravitax/gpu/rec_tangents.py +66 -0
- gravitax-1.0.0/gravitax/gpu/tangent_layout.py +205 -0
- gravitax-1.0.0/gravitax/gpu_api.py +428 -0
- gravitax-1.0.0/gravitax/gpu_api_grad.py +712 -0
- gravitax-1.0.0/gravitax/gpu_api_pk.py +301 -0
- gravitax-1.0.0/gravitax/grids.py +422 -0
- gravitax-1.0.0/gravitax/grids_jax.py +98 -0
- gravitax-1.0.0/gravitax/halofit.py +200 -0
- gravitax-1.0.0/gravitax/hlo_check.py +159 -0
- gravitax-1.0.0/gravitax/hmcode2016.py +747 -0
- gravitax-1.0.0/gravitax/hmcode2020.py +389 -0
- gravitax-1.0.0/gravitax/joint.py +531 -0
- gravitax-1.0.0/gravitax/kernel_spec.py +1171 -0
- gravitax-1.0.0/gravitax/kernel_spec_mg.py +246 -0
- gravitax-1.0.0/gravitax/lensing.py +467 -0
- gravitax-1.0.0/gravitax/lensing_corr.py +432 -0
- gravitax-1.0.0/gravitax/lensing_jvp.py +29 -0
- gravitax-1.0.0/gravitax/lensing_pallas.py +224 -0
- gravitax-1.0.0/gravitax/los_batched.py +188 -0
- gravitax-1.0.0/gravitax/los_gemm.py +853 -0
- gravitax-1.0.0/gravitax/los_integration.py +615 -0
- gravitax-1.0.0/gravitax/modified_gravity.py +433 -0
- gravitax-1.0.0/gravitax/nonlinear_lensing.py +254 -0
- gravitax-1.0.0/gravitax/parallel.py +126 -0
- gravitax-1.0.0/gravitax/params.py +193 -0
- gravitax-1.0.0/gravitax/perturbations.py +1580 -0
- gravitax-1.0.0/gravitax/power_spectrum.py +1169 -0
- gravitax-1.0.0/gravitax/presets.py +157 -0
- gravitax-1.0.0/gravitax/primordial.py +13 -0
- gravitax-1.0.0/gravitax/psi_route.py +57 -0
- gravitax-1.0.0/gravitax/rec_kernel_spec.py +205 -0
- gravitax-1.0.0/gravitax/rodas5p.py +225 -0
- gravitax-1.0.0/gravitax/rsa.py +172 -0
- gravitax-1.0.0/gravitax/rsa_mnu.py +125 -0
- gravitax-1.0.0/gravitax/solvers.py +1458 -0
- gravitax-1.0.0/gravitax/source_cache.py +148 -0
- gravitax-1.0.0/gravitax/sparse_jac.py +273 -0
- gravitax-1.0.0/gravitax/spline.py +514 -0
- gravitax-1.0.0/gravitax/step_lane.py +156 -0
- gravitax-1.0.0/gravitax/thermodynamics.py +2160 -0
- gravitax-1.0.0/gravitax/theta_inversion.py +203 -0
- gravitax-1.0.0/gravitax/utils.py +27 -0
- gravitax-1.0.0/gravitax/weyl_highk.py +116 -0
- gravitax-1.0.0/gravitax.egg-info/PKG-INFO +242 -0
- gravitax-1.0.0/gravitax.egg-info/SOURCES.txt +271 -0
- gravitax-1.0.0/gravitax.egg-info/dependency_links.txt +1 -0
- gravitax-1.0.0/gravitax.egg-info/requires.txt +34 -0
- gravitax-1.0.0/gravitax.egg-info/top_level.txt +1 -0
- gravitax-1.0.0/pyproject.toml +83 -0
- gravitax-1.0.0/setup.cfg +4 -0
- gravitax-1.0.0/tests/__init__.py +0 -0
- gravitax-1.0.0/tests/_fiducial.py +118 -0
- gravitax-1.0.0/tests/_params.py +8 -0
- gravitax-1.0.0/tests/conftest.py +80 -0
- gravitax-1.0.0/tests/data/chi_box2s_N500.npy +0 -0
- gravitax-1.0.0/tests/data/isw_lcdm_sources_golden.npz +0 -0
- gravitax-1.0.0/tests/data/pk_baseline_mnu0.npz +0 -0
- gravitax-1.0.0/tests/data/recfast_rhs_vectors.npz +0 -0
- gravitax-1.0.0/tests/fixtures/kvaerno5_forward_ref.npz +0 -0
- gravitax-1.0.0/tests/fixtures/reion_baseline_fiducial.npz +0 -0
- gravitax-1.0.0/tests/refs/dl_ee_fiducial.npy +0 -0
- gravitax-1.0.0/tests/refs/dl_pp_fiducial.npy +0 -0
- gravitax-1.0.0/tests/refs/dl_te_fiducial.npy +0 -0
- gravitax-1.0.0/tests/refs/dl_tt_fiducial.npy +0 -0
- gravitax-1.0.0/tests/refs/ells_fiducial.npy +0 -0
- gravitax-1.0.0/tests/test_accurate_knobs.py +58 -0
- gravitax-1.0.0/tests/test_ap_imex_grid.py +48 -0
- gravitax-1.0.0/tests/test_api.py +242 -0
- gravitax-1.0.0/tests/test_background.py +47 -0
- gravitax-1.0.0/tests/test_batched_solver.py +223 -0
- gravitax-1.0.0/tests/test_bessel_disk_cache.py +331 -0
- gravitax-1.0.0/tests/test_bessel_dx_parity.py +72 -0
- gravitax-1.0.0/tests/test_block_solver.py +188 -0
- gravitax-1.0.0/tests/test_cache_whitelist.py +40 -0
- gravitax-1.0.0/tests/test_channel_mask_parity.py +47 -0
- gravitax-1.0.0/tests/test_cheb_cl.py +65 -0
- gravitax-1.0.0/tests/test_cheb_panels.py +42 -0
- gravitax-1.0.0/tests/test_closures_from_papers.py +89 -0
- gravitax-1.0.0/tests/test_cls.py +73 -0
- gravitax-1.0.0/tests/test_compute_cls_and_pk.py +227 -0
- gravitax-1.0.0/tests/test_compute_cls_batch_runs.py +20 -0
- gravitax-1.0.0/tests/test_compute_pk_ap_imex.py +312 -0
- gravitax-1.0.0/tests/test_config_guard_highl.py +26 -0
- gravitax-1.0.0/tests/test_dark_energy.py +66 -0
- gravitax-1.0.0/tests/test_drag_epoch.py +36 -0
- gravitax-1.0.0/tests/test_ell_loop_parity.py +237 -0
- gravitax-1.0.0/tests/test_ell_sampling.py +127 -0
- gravitax-1.0.0/tests/test_evolve_single_k_joint.py +108 -0
- gravitax-1.0.0/tests/test_gpu_api.py +162 -0
- gravitax-1.0.0/tests/test_gpu_api_grad.py +270 -0
- gravitax-1.0.0/tests/test_gpu_api_pk.py +49 -0
- gravitax-1.0.0/tests/test_grids_jax.py +57 -0
- gravitax-1.0.0/tests/test_halofit.py +144 -0
- gravitax-1.0.0/tests/test_halofit_hook.py +33 -0
- gravitax-1.0.0/tests/test_highl_option.py +106 -0
- gravitax-1.0.0/tests/test_highl_preset_record.py +43 -0
- gravitax-1.0.0/tests/test_ics_series.py +138 -0
- gravitax-1.0.0/tests/test_import_all.py +24 -0
- gravitax-1.0.0/tests/test_isw_de_term.py +35 -0
- gravitax-1.0.0/tests/test_kernel_spec_mg.py +107 -0
- gravitax-1.0.0/tests/test_kernel_spec_pk.py +53 -0
- gravitax-1.0.0/tests/test_kernel_spec_tables.py +49 -0
- gravitax-1.0.0/tests/test_kvaerno5_derivatives.py +121 -0
- gravitax-1.0.0/tests/test_lensing.py +126 -0
- gravitax-1.0.0/tests/test_lensing_batch.py +142 -0
- gravitax-1.0.0/tests/test_lensing_corr.py +334 -0
- gravitax-1.0.0/tests/test_lensing_jvp_routes.py +33 -0
- gravitax-1.0.0/tests/test_lensing_pallas_gpu.py +79 -0
- gravitax-1.0.0/tests/test_lensing_pallas_jvp.py +55 -0
- gravitax-1.0.0/tests/test_lensing_traced_ells.py +95 -0
- gravitax-1.0.0/tests/test_lhs_truncation.py +19 -0
- gravitax-1.0.0/tests/test_loga_background.py +38 -0
- gravitax-1.0.0/tests/test_los_batched_jvp.py +315 -0
- gravitax-1.0.0/tests/test_los_cl_chunks.py +174 -0
- gravitax-1.0.0/tests/test_los_late_fold.py +60 -0
- gravitax-1.0.0/tests/test_los_vmap_scan.py +101 -0
- gravitax-1.0.0/tests/test_lu_reciprocal_fwd.py +63 -0
- gravitax-1.0.0/tests/test_massive_nu.py +166 -0
- gravitax-1.0.0/tests/test_mnu_fast_bare_block.py +108 -0
- gravitax-1.0.0/tests/test_mnu_fast_dfa.py +148 -0
- gravitax-1.0.0/tests/test_mnu_fast_fluid.py +164 -0
- gravitax-1.0.0/tests/test_mnu_fast_kernel_spec.py +125 -0
- gravitax-1.0.0/tests/test_mnu_fast_quadrature.py +66 -0
- gravitax-1.0.0/tests/test_mnu_fast_solve.py +116 -0
- gravitax-1.0.0/tests/test_mnu_kern_knobs.py +214 -0
- gravitax-1.0.0/tests/test_mnu_kernel_variants.py +299 -0
- gravitax-1.0.0/tests/test_mnu_late_switch.py +164 -0
- gravitax-1.0.0/tests/test_mnu_lmax_nu_massless.py +73 -0
- gravitax-1.0.0/tests/test_mnu_nu_ur.py +167 -0
- gravitax-1.0.0/tests/test_mnu_pattern_float32.py +46 -0
- gravitax-1.0.0/tests/test_mnu_pre_fast.py +20 -0
- gravitax-1.0.0/tests/test_mnu_pre_rec_host.py +66 -0
- gravitax-1.0.0/tests/test_mnu_rec_host.py +101 -0
- gravitax-1.0.0/tests/test_mnu_rec_tangent.py +113 -0
- gravitax-1.0.0/tests/test_mnu_rsa_record.py +64 -0
- gravitax-1.0.0/tests/test_mnu_tan_build_options.py +80 -0
- gravitax-1.0.0/tests/test_mnu_tan_late.py +124 -0
- gravitax-1.0.0/tests/test_mnu_tan_precision.py +87 -0
- gravitax-1.0.0/tests/test_mnu_tan_residual.py +57 -0
- gravitax-1.0.0/tests/test_mnu_tan_shared_primal.py +88 -0
- gravitax-1.0.0/tests/test_mnu_tangent_split.py +56 -0
- gravitax-1.0.0/tests/test_mnu_two_launch_zero_length.py +51 -0
- gravitax-1.0.0/tests/test_mnu_weyl_rows.py +640 -0
- gravitax-1.0.0/tests/test_modified_gravity.py +259 -0
- gravitax-1.0.0/tests/test_n_k_fine_parity.py +54 -0
- gravitax-1.0.0/tests/test_n_run.py +58 -0
- gravitax-1.0.0/tests/test_neutrino_heating.py +38 -0
- gravitax-1.0.0/tests/test_nu_quadrature.py +126 -0
- gravitax-1.0.0/tests/test_nu_quadrature_literals.py +52 -0
- gravitax-1.0.0/tests/test_option_values.py +39 -0
- gravitax-1.0.0/tests/test_p_cb.py +137 -0
- gravitax-1.0.0/tests/test_param_guards.py +35 -0
- gravitax-1.0.0/tests/test_pk.py +199 -0
- gravitax-1.0.0/tests/test_pk_cheb.py +60 -0
- gravitax-1.0.0/tests/test_pk_derivative.py +77 -0
- gravitax-1.0.0/tests/test_pk_fp32_batched.py +143 -0
- gravitax-1.0.0/tests/test_pk_per_k_tol.py +79 -0
- gravitax-1.0.0/tests/test_pk_preset.py +85 -0
- gravitax-1.0.0/tests/test_pk_rodas5_batched_derivative_cpu.py +35 -0
- gravitax-1.0.0/tests/test_pk_start_floor.py +40 -0
- gravitax-1.0.0/tests/test_pre_pipeline.py +116 -0
- gravitax-1.0.0/tests/test_pre_rest_device.py +105 -0
- gravitax-1.0.0/tests/test_precision_presets.py +116 -0
- gravitax-1.0.0/tests/test_rec_fuse_start.py +82 -0
- gravitax-1.0.0/tests/test_recfast_he_fit.py +202 -0
- gravitax-1.0.0/tests/test_recfast_rhs_vectors.py +76 -0
- gravitax-1.0.0/tests/test_reference_preset_data.py +62 -0
- gravitax-1.0.0/tests/test_reion_loopfree.py +186 -0
- gravitax-1.0.0/tests/test_reion_off.py +78 -0
- gravitax-1.0.0/tests/test_reionization.py +209 -0
- gravitax-1.0.0/tests/test_release_scope.py +87 -0
- gravitax-1.0.0/tests/test_residual_check_explicit.py +73 -0
- gravitax-1.0.0/tests/test_rodas5p.py +189 -0
- gravitax-1.0.0/tests/test_rodas5p_defaults.py +99 -0
- gravitax-1.0.0/tests/test_spline.py +728 -0
- gravitax-1.0.0/tests/test_spline_pcr.py +97 -0
- gravitax-1.0.0/tests/test_static_imports.py +127 -0
- gravitax-1.0.0/tests/test_step_lane.py +146 -0
- gravitax-1.0.0/tests/test_tab_tau_end.py +61 -0
- gravitax-1.0.0/tests/test_tangent_late_start.py +64 -0
- gravitax-1.0.0/tests/test_thermo_recomb_data_schema.py +34 -0
- gravitax-1.0.0/tests/test_thermo_reion_window.py +64 -0
- gravitax-1.0.0/tests/test_thermo_segscan_full.py +159 -0
- gravitax-1.0.0/tests/test_thermo_segscan_rodas5p.py +95 -0
- gravitax-1.0.0/tests/test_thermodynamics.py +92 -0
- gravitax-1.0.0/tests/test_theta_inversion.py +152 -0
- gravitax-1.0.0/tests/test_uniform_interp_grid.py +88 -0
- gravitax-1.0.0/tests/test_uniform_linear_spline.py +126 -0
- gravitax-1.0.0/tests/test_uniform_spline.py +61 -0
- gravitax-1.0.0/tests/test_verbose.py +69 -0
- gravitax-1.0.0/tests/test_vmap_cosmologies_lhs.py +62 -0
- gravitax-1.0.0/tests/test_weyl_highk.py +115 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
First public release.
|
|
6
|
+
|
|
7
|
+
GRAVITAX is a differentiable Einstein-Boltzmann code written in JAX, with a high-level interface (`set_params`, `get_results`) and the entry points `compute_cls`, `compute_lensed_cls`, `compute_pk` and `compute_cls_and_pk`.
|
|
8
|
+
|
|
9
|
+
- **Observables.** Unlensed and lensed CMB temperature and polarisation spectra (TT, EE, TE, BB), the lensing potential spectrum, the linear matter power spectrum P(k, z) with sigma_8, and the nonlinear matter power spectrum from HMcode (`compute_pk(..., nonlinear="hmcode2020")`) or HALOFIT (`nonlinear="halofit"`).
|
|
10
|
+
- **Physics.** LCDM, massive neutrinos, dark energy with a CPL equation of state, mu-Sigma modified gravity, RECFAST recombination, reionization, and curved-sky lensing.
|
|
11
|
+
- **Derivatives.** Exact derivatives of the observables with respect to the cosmological parameters.
|
|
12
|
+
- **GPU route.** `gpu_spectra` / `GPUSpectra` (batched lensed CMB spectra) and `gpu_derivatives` / `GPUDerivatives` (the same spectra with their derivatives along omega_b h^2, omega_c h^2, h, ln 10^10 A_s and n_s) and `gpu_pk_derivatives` / `GPUPkDerivatives` (the linear matter power spectrum at z = 0 with its derivatives along the same directions), at named settings (`default`, `balanced`, `analysis`, `accurate`) that ship as package data.
|
|
13
|
+
- **Messages.** Quiet by default; `set_verbose(True)` or `GRAVITAX_VERBOSE=1` shows progress messages and the GPU kernel build output.
|
|
14
|
+
- **Documentation and examples.** Documentation and scripts under `examples/`.
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
title: "GRAVITAX: a differentiable Einstein-Boltzmann code in JAX"
|
|
4
|
+
abstract: >-
|
|
5
|
+
Differentiable Einstein-Boltzmann code in JAX: lensed CMB and
|
|
6
|
+
lensing-potential spectra and linear and nonlinear matter power spectra
|
|
7
|
+
with exact derivatives, batched on GPUs; modified gravity through mu and
|
|
8
|
+
Sigma.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: "Spurio Mancini"
|
|
12
|
+
given-names: "Alessio"
|
|
13
|
+
email: "alessio.spuriomancini@rhul.ac.uk"
|
|
14
|
+
affiliation: "Royal Holloway, University of London"
|
|
15
|
+
version: "1.0.0"
|
|
16
|
+
date-released: "2026-12-04"
|
|
17
|
+
license: MIT
|
|
18
|
+
repository-code: "https://github.com/ECLIPSE-AI4Science/gravitax"
|
|
19
|
+
url: "https://eclipse-ai4science.github.io/gravitax/"
|
|
20
|
+
keywords:
|
|
21
|
+
- cosmology
|
|
22
|
+
- cosmic microwave background
|
|
23
|
+
- Boltzmann solver
|
|
24
|
+
- Einstein-Boltzmann
|
|
25
|
+
- JAX
|
|
26
|
+
- automatic differentiation
|
|
27
|
+
- differentiable programming
|
|
28
|
+
preferred-citation:
|
|
29
|
+
type: article
|
|
30
|
+
status: preprint
|
|
31
|
+
title: "GRAVITAX: testing gravity with a differentiable Boltzmann code"
|
|
32
|
+
authors:
|
|
33
|
+
- family-names: "Spurio Mancini"
|
|
34
|
+
given-names: "Alessio"
|
|
35
|
+
year: 2026
|
|
36
|
+
doi: "10.48550/arXiv.2612.06208"
|
|
37
|
+
url: "https://arxiv.org/abs/2612.06208"
|
|
38
|
+
identifiers:
|
|
39
|
+
- type: other
|
|
40
|
+
value: "arXiv:2612.06208"
|
|
41
|
+
description: "arXiv identifier"
|
|
42
|
+
references:
|
|
43
|
+
- type: article
|
|
44
|
+
status: preprint
|
|
45
|
+
title: "GRAVITAX: testing gravity with a differentiable Boltzmann code"
|
|
46
|
+
authors:
|
|
47
|
+
- family-names: "Spurio Mancini"
|
|
48
|
+
given-names: "Alessio"
|
|
49
|
+
year: 2026
|
|
50
|
+
doi: "10.48550/arXiv.2612.06208"
|
|
51
|
+
url: "https://arxiv.org/abs/2612.06208"
|
|
52
|
+
- type: article
|
|
53
|
+
status: preprint
|
|
54
|
+
title: "GRADSOLVE: fast exact gradients for ODE ensembles on GPUs"
|
|
55
|
+
authors:
|
|
56
|
+
- family-names: "Spurio Mancini"
|
|
57
|
+
given-names: "Alessio"
|
|
58
|
+
year: 2026
|
|
59
|
+
url: "https://arxiv.org/abs/2609.02876"
|
|
60
|
+
repository-code: "https://github.com/ECLIPSE-AI4Science/gradsolve"
|
|
61
|
+
- type: article
|
|
62
|
+
title: "Efficient Computation of Cosmic Microwave Background Anisotropies in Closed Friedmann-Robertson-Walker Models"
|
|
63
|
+
authors:
|
|
64
|
+
- family-names: "Lewis"
|
|
65
|
+
given-names: "Antony"
|
|
66
|
+
- family-names: "Challinor"
|
|
67
|
+
given-names: "Anthony"
|
|
68
|
+
- family-names: "Lasenby"
|
|
69
|
+
given-names: "Anthony"
|
|
70
|
+
journal: "Astrophysical Journal"
|
|
71
|
+
volume: 538
|
|
72
|
+
start: "473"
|
|
73
|
+
year: 2000
|
|
74
|
+
url: "https://arxiv.org/abs/astro-ph/9911177"
|
|
75
|
+
- type: article
|
|
76
|
+
title: "CAMB 2: cosmological power spectra for high-precision surveys"
|
|
77
|
+
authors:
|
|
78
|
+
- family-names: "Lewis"
|
|
79
|
+
given-names: "Antony"
|
|
80
|
+
journal: "Journal of Cosmology and Astroparticle Physics"
|
|
81
|
+
volume: 2026
|
|
82
|
+
issue: "10"
|
|
83
|
+
start: "013"
|
|
84
|
+
year: 2026
|
|
85
|
+
doi: "10.1088/1475-7516/2026/10/013"
|
|
86
|
+
url: "https://arxiv.org/abs/2607.14854"
|
|
87
|
+
- type: article
|
|
88
|
+
title: "The Cosmic Linear Anisotropy Solving System (CLASS) I: Overview"
|
|
89
|
+
authors:
|
|
90
|
+
- family-names: "Lesgourgues"
|
|
91
|
+
given-names: "Julien"
|
|
92
|
+
year: 2011
|
|
93
|
+
url: "https://arxiv.org/abs/1104.2932"
|
|
94
|
+
- type: article
|
|
95
|
+
title: "The Cosmic Linear Anisotropy Solving System (CLASS). Part II: Approximation schemes"
|
|
96
|
+
authors:
|
|
97
|
+
- family-names: "Blas"
|
|
98
|
+
given-names: "Diego"
|
|
99
|
+
- family-names: "Lesgourgues"
|
|
100
|
+
given-names: "Julien"
|
|
101
|
+
- family-names: "Tram"
|
|
102
|
+
given-names: "Thomas"
|
|
103
|
+
journal: "Journal of Cosmology and Astroparticle Physics"
|
|
104
|
+
volume: 2011
|
|
105
|
+
issue: "07"
|
|
106
|
+
start: "034"
|
|
107
|
+
year: 2011
|
|
108
|
+
doi: "10.1088/1475-7516/2011/07/034"
|
|
109
|
+
url: "https://arxiv.org/abs/1104.2933"
|
|
110
|
+
- type: article
|
|
111
|
+
title: "An accurate halo model for fitting non-linear cosmological power spectra and baryonic feedback models"
|
|
112
|
+
authors:
|
|
113
|
+
- family-names: "Mead"
|
|
114
|
+
given-names: "A. J."
|
|
115
|
+
- family-names: "Peacock"
|
|
116
|
+
given-names: "J. A."
|
|
117
|
+
- family-names: "Heymans"
|
|
118
|
+
given-names: "C."
|
|
119
|
+
- family-names: "Joudaki"
|
|
120
|
+
given-names: "S."
|
|
121
|
+
- family-names: "Heavens"
|
|
122
|
+
given-names: "A. F."
|
|
123
|
+
journal: "Monthly Notices of the Royal Astronomical Society"
|
|
124
|
+
volume: 454
|
|
125
|
+
start: "1958"
|
|
126
|
+
year: 2015
|
|
127
|
+
doi: "10.1093/mnras/stv2036"
|
|
128
|
+
url: "https://arxiv.org/abs/1505.07833"
|
|
129
|
+
- type: article
|
|
130
|
+
title: "Accurate halo-model matter power spectra with dark energy, massive neutrinos and modified gravitational forces"
|
|
131
|
+
authors:
|
|
132
|
+
- family-names: "Mead"
|
|
133
|
+
given-names: "A. J."
|
|
134
|
+
- family-names: "Heymans"
|
|
135
|
+
given-names: "C."
|
|
136
|
+
- family-names: "Lombriser"
|
|
137
|
+
given-names: "L."
|
|
138
|
+
- family-names: "Peacock"
|
|
139
|
+
given-names: "J. A."
|
|
140
|
+
- family-names: "Steele"
|
|
141
|
+
given-names: "O. I."
|
|
142
|
+
- family-names: "Winther"
|
|
143
|
+
given-names: "H. A."
|
|
144
|
+
journal: "Monthly Notices of the Royal Astronomical Society"
|
|
145
|
+
volume: 459
|
|
146
|
+
start: "1468"
|
|
147
|
+
year: 2016
|
|
148
|
+
url: "https://arxiv.org/abs/1602.02154"
|
|
149
|
+
- type: article
|
|
150
|
+
title: "HMcode-2020: improved modelling of non-linear cosmological power spectra with baryonic feedback"
|
|
151
|
+
authors:
|
|
152
|
+
- family-names: "Mead"
|
|
153
|
+
given-names: "A. J."
|
|
154
|
+
- family-names: "Brieden"
|
|
155
|
+
given-names: "S."
|
|
156
|
+
- family-names: "Tröster"
|
|
157
|
+
given-names: "T."
|
|
158
|
+
- family-names: "Heymans"
|
|
159
|
+
given-names: "C."
|
|
160
|
+
journal: "Monthly Notices of the Royal Astronomical Society"
|
|
161
|
+
volume: 502
|
|
162
|
+
start: "1401"
|
|
163
|
+
year: 2021
|
|
164
|
+
url: "https://arxiv.org/abs/2009.01858"
|
|
165
|
+
- type: article
|
|
166
|
+
title: "Stable clustering, the halo model and non-linear cosmological power spectra"
|
|
167
|
+
authors:
|
|
168
|
+
- family-names: "Smith"
|
|
169
|
+
given-names: "R. E."
|
|
170
|
+
- family-names: "Peacock"
|
|
171
|
+
given-names: "J. A."
|
|
172
|
+
- family-names: "Jenkins"
|
|
173
|
+
given-names: "A."
|
|
174
|
+
- family-names: "White"
|
|
175
|
+
given-names: "S. D. M."
|
|
176
|
+
- family-names: "Frenk"
|
|
177
|
+
given-names: "C. S."
|
|
178
|
+
- family-names: "Pearce"
|
|
179
|
+
given-names: "F. R."
|
|
180
|
+
- family-names: "Thomas"
|
|
181
|
+
given-names: "P. A."
|
|
182
|
+
- family-names: "Efstathiou"
|
|
183
|
+
given-names: "G."
|
|
184
|
+
- family-names: "Couchman"
|
|
185
|
+
given-names: "H. M. P."
|
|
186
|
+
journal: "Monthly Notices of the Royal Astronomical Society"
|
|
187
|
+
volume: 341
|
|
188
|
+
start: "1311"
|
|
189
|
+
year: 2003
|
|
190
|
+
doi: "10.1046/j.1365-8711.2003.06503.x"
|
|
191
|
+
url: "https://arxiv.org/abs/astro-ph/0207664"
|
|
192
|
+
- type: article
|
|
193
|
+
title: "Revising the Halofit Model for the Nonlinear Matter Power Spectrum"
|
|
194
|
+
authors:
|
|
195
|
+
- family-names: "Takahashi"
|
|
196
|
+
given-names: "Ryuichi"
|
|
197
|
+
- family-names: "Sato"
|
|
198
|
+
given-names: "Masanori"
|
|
199
|
+
- family-names: "Nishimichi"
|
|
200
|
+
given-names: "Takahiro"
|
|
201
|
+
- family-names: "Taruya"
|
|
202
|
+
given-names: "Atsushi"
|
|
203
|
+
- family-names: "Oguri"
|
|
204
|
+
given-names: "Masamune"
|
|
205
|
+
journal: "Astrophysical Journal"
|
|
206
|
+
volume: 761
|
|
207
|
+
start: "152"
|
|
208
|
+
year: 2012
|
|
209
|
+
doi: "10.1088/0004-637X/761/2/152"
|
|
210
|
+
url: "https://arxiv.org/abs/1208.2701"
|
|
211
|
+
- type: article
|
|
212
|
+
title: "Massive neutrinos and the non-linear matter power spectrum"
|
|
213
|
+
authors:
|
|
214
|
+
- family-names: "Bird"
|
|
215
|
+
given-names: "Simeon"
|
|
216
|
+
- family-names: "Viel"
|
|
217
|
+
given-names: "Matteo"
|
|
218
|
+
- family-names: "Haehnelt"
|
|
219
|
+
given-names: "Martin G."
|
|
220
|
+
journal: "Monthly Notices of the Royal Astronomical Society"
|
|
221
|
+
volume: 420
|
|
222
|
+
start: "2551"
|
|
223
|
+
year: 2012
|
|
224
|
+
doi: "10.1111/j.1365-2966.2011.20222.x"
|
|
225
|
+
url: "https://arxiv.org/abs/1109.4416"
|
|
226
|
+
- type: article
|
|
227
|
+
title: "Searching for modified growth patterns with tomographic surveys"
|
|
228
|
+
authors:
|
|
229
|
+
- family-names: "Zhao"
|
|
230
|
+
given-names: "Gong-Bo"
|
|
231
|
+
- family-names: "Pogosian"
|
|
232
|
+
given-names: "Levon"
|
|
233
|
+
- family-names: "Silvestri"
|
|
234
|
+
given-names: "Alessandra"
|
|
235
|
+
- family-names: "Zylberberg"
|
|
236
|
+
given-names: "Joel"
|
|
237
|
+
journal: "Physical Review D"
|
|
238
|
+
volume: 79
|
|
239
|
+
start: "083513"
|
|
240
|
+
year: 2009
|
|
241
|
+
doi: "10.1103/PhysRevD.79.083513"
|
|
242
|
+
url: "https://arxiv.org/abs/0809.3791"
|
|
243
|
+
- type: article
|
|
244
|
+
title: "Testing gravity with CAMB and CosmoMC"
|
|
245
|
+
authors:
|
|
246
|
+
- family-names: "Hojjati"
|
|
247
|
+
given-names: "Alireza"
|
|
248
|
+
- family-names: "Pogosian"
|
|
249
|
+
given-names: "Levon"
|
|
250
|
+
- family-names: "Zhao"
|
|
251
|
+
given-names: "Gong-Bo"
|
|
252
|
+
journal: "Journal of Cosmology and Astroparticle Physics"
|
|
253
|
+
volume: 2011
|
|
254
|
+
issue: "08"
|
|
255
|
+
start: "005"
|
|
256
|
+
year: 2011
|
|
257
|
+
url: "https://arxiv.org/abs/1106.4543"
|
|
258
|
+
- type: article
|
|
259
|
+
title: "MGCAMB with massive neutrinos and dynamical dark energy"
|
|
260
|
+
authors:
|
|
261
|
+
- family-names: "Zucca"
|
|
262
|
+
given-names: "A."
|
|
263
|
+
- family-names: "Pogosian"
|
|
264
|
+
given-names: "L."
|
|
265
|
+
- family-names: "Silvestri"
|
|
266
|
+
given-names: "A."
|
|
267
|
+
- family-names: "Zhao"
|
|
268
|
+
given-names: "G. B."
|
|
269
|
+
journal: "Journal of Cosmology and Astroparticle Physics"
|
|
270
|
+
volume: 2019
|
|
271
|
+
issue: "05"
|
|
272
|
+
start: "001"
|
|
273
|
+
year: 2019
|
|
274
|
+
url: "https://arxiv.org/abs/1901.05956"
|
|
275
|
+
- type: article
|
|
276
|
+
title: "New MGCAMB tests of gravity with CosmoMC and Cobaya"
|
|
277
|
+
authors:
|
|
278
|
+
- family-names: "Wang"
|
|
279
|
+
given-names: "Zhuangfei"
|
|
280
|
+
- family-names: "Mirpoorian"
|
|
281
|
+
given-names: "Seyed Hamidreza"
|
|
282
|
+
- family-names: "Pogosian"
|
|
283
|
+
given-names: "Levon"
|
|
284
|
+
- family-names: "Silvestri"
|
|
285
|
+
given-names: "Alessandra"
|
|
286
|
+
- family-names: "Zhao"
|
|
287
|
+
given-names: "Gong-Bo"
|
|
288
|
+
journal: "Journal of Cosmology and Astroparticle Physics"
|
|
289
|
+
volume: 2023
|
|
290
|
+
issue: "08"
|
|
291
|
+
start: "038"
|
|
292
|
+
year: 2023
|
|
293
|
+
doi: "10.1088/1475-7516/2023/08/038"
|
|
294
|
+
url: "https://arxiv.org/abs/2305.05667"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Contributing to GRAVITAX
|
|
2
|
+
|
|
3
|
+
Thank you for helping to improve GRAVITAX. This guide is short on purpose.
|
|
4
|
+
|
|
5
|
+
## Development set-up
|
|
6
|
+
|
|
7
|
+
GRAVITAX needs Python 3.11 or newer. Install it in editable mode with the test extra:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install -e '.[test]'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Importing `gravitax` switches JAX to double precision (`jax_enable_x64`).
|
|
14
|
+
|
|
15
|
+
## Checks to run before a pull request
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pytest -q # the test suite on a CPU
|
|
19
|
+
python -m build # the sdist and the wheel must build
|
|
20
|
+
twine check dist/* # must report PASSED
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tests marked `slow` are skipped by default; run them with `pytest -m slow` when you change the solver.
|
|
24
|
+
The GPU route (`gravitax[gpu]`) needs an NVIDIA GPU. If you change it, run
|
|
25
|
+
`gpu_spectra` and `gpu_derivatives` on a GPU and say in the pull request how you checked the result.
|
|
26
|
+
|
|
27
|
+
## What a pull request should contain
|
|
28
|
+
|
|
29
|
+
- One logical change.
|
|
30
|
+
- A test for any change of behaviour; `pytest -q` passes.
|
|
31
|
+
- An entry in [`CHANGELOG.md`](CHANGELOG.md), newest first, in the same pull request.
|
|
32
|
+
- A matching update of the documentation under `docs/` when public behaviour changes.
|
|
33
|
+
|
|
34
|
+
## Licence of contributions
|
|
35
|
+
|
|
36
|
+
By contributing you agree that your contribution is released under the project's [MIT License](LICENSE).
|
gravitax-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alessio Spurio Mancini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# The sdist carries the package, its tests, the documentation and the examples.
|
|
2
|
+
recursive-include tests *.py *.npz *.npy *.json *.txt *.csv *.dat
|
|
3
|
+
recursive-include docs *.md *.py *.txt
|
|
4
|
+
include examples/*.py examples/README.md
|
|
5
|
+
include CITATION.cff CONTRIBUTING.md CHANGELOG.md README.md LICENSE
|
|
6
|
+
global-exclude *.pyc __pycache__
|
gravitax-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gravitax
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Differentiable Einstein-Boltzmann code in JAX: lensed CMB and lensing-potential spectra and linear and nonlinear matter power spectra with exact derivatives, batched on GPUs; modified gravity through mu and Sigma.
|
|
5
|
+
Author-email: Alessio Spurio Mancini <alessio.spuriomancini@rhul.ac.uk>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ECLIPSE-AI4Science/gravitax
|
|
8
|
+
Project-URL: Repository, https://github.com/ECLIPSE-AI4Science/gravitax
|
|
9
|
+
Project-URL: Documentation, https://eclipse-ai4science.github.io/gravitax/
|
|
10
|
+
Keywords: cosmology,CMB,Boltzmann,Einstein-Boltzmann,JAX,automatic-differentiation,differentiable-programming
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: jax>=0.10
|
|
21
|
+
Requires-Dist: diffrax>=0.7.2
|
|
22
|
+
Requires-Dist: interpax>=0.3.12
|
|
23
|
+
Requires-Dist: equinox>=0.13.4
|
|
24
|
+
Requires-Dist: lineax>=0.1.0
|
|
25
|
+
Requires-Dist: numpy>=2.4
|
|
26
|
+
Requires-Dist: scipy>=1.17
|
|
27
|
+
Provides-Extra: gpu
|
|
28
|
+
Requires-Dist: jax[cuda12]>=0.10; extra == "gpu"
|
|
29
|
+
Requires-Dist: gradsolve>=0.5.0; extra == "gpu"
|
|
30
|
+
Provides-Extra: ram-check
|
|
31
|
+
Requires-Dist: psutil>=5.9; extra == "ram-check"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-xdist; extra == "test"
|
|
35
|
+
Requires-Dist: matplotlib; extra == "test"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
38
|
+
Requires-Dist: furo; extra == "docs"
|
|
39
|
+
Requires-Dist: myst-parser>=2.0; extra == "docs"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
43
|
+
Requires-Dist: sphinx>=7.0; extra == "dev"
|
|
44
|
+
Requires-Dist: furo; extra == "dev"
|
|
45
|
+
Requires-Dist: myst-parser>=2.0; extra == "dev"
|
|
46
|
+
Requires-Dist: matplotlib; extra == "dev"
|
|
47
|
+
Requires-Dist: jupyter; extra == "dev"
|
|
48
|
+
Requires-Dist: build; extra == "dev"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# GRAVITAX
|
|
52
|
+
|
|
53
|
+
<p>
|
|
54
|
+
<a href="https://pypi.org/project/gravitax/"><img alt="PyPI" src="https://img.shields.io/pypi/v/gravitax?color=181717"></a>
|
|
55
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-181717"></a>
|
|
56
|
+
<a href="https://eclipse-ai4science.github.io/gravitax/"><img alt="Documentation" src="https://img.shields.io/badge/docs-online-181717"></a>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
**A differentiable Einstein-Boltzmann code in JAX.**
|
|
60
|
+
|
|
61
|
+
GRAVITAX solves the linear Einstein-Boltzmann equations for flat cosmologies with massive neutrinos. It
|
|
62
|
+
returns the lensed CMB spectra (TT, EE, TE, BB), the lensing-potential spectrum, and the linear and
|
|
63
|
+
nonlinear matter power spectra with sigma_8. Every output has exact derivatives with respect to the
|
|
64
|
+
cosmological parameters. Modified gravity enters through the functions mu(a, k) and Sigma(a, k). A GPU
|
|
65
|
+
route computes the lensed spectra of a whole batch of cosmologies in one call, with or without their
|
|
66
|
+
derivatives, and the linear matter power spectrum with its derivatives. On GPUs, GRAVITAX solves the Einstein-Boltzmann equations and their derivatives with
|
|
67
|
+
[gradsolve](https://github.com/ECLIPSE-AI4Science/gradsolve). Typical uses are gradient-based inference, Fisher
|
|
68
|
+
forecasts and emulator training.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install gravitax
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
GRAVITAX needs Python 3.11 or newer. The GPU route needs the `gpu` extra:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install "gravitax[gpu]"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It requires Linux, an NVIDIA GPU, CUDA 12 with `nvcc` on `PATH`, and a host C++ compiler. The extra installs
|
|
83
|
+
`jax[cuda12]` and [gradsolve](https://github.com/ECLIPSE-AI4Science/gradsolve), which provides the CUDA kernels.
|
|
84
|
+
|
|
85
|
+
## Quick start on a CPU
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from gravitax import set_params, get_results, compute_pk
|
|
89
|
+
from gravitax.background import compute_background
|
|
90
|
+
from gravitax.thermodynamics import compute_thermodynamics
|
|
91
|
+
|
|
92
|
+
pars = set_params(H0=67.36, ombh2=0.02237, omch2=0.1200, As=2.1e-9, ns=0.9649, tau=0.0544,
|
|
93
|
+
lmax=2500, lens_potential_accuracy=1) # lens_potential_accuracy > 0 turns lensing on
|
|
94
|
+
results = get_results(pars)
|
|
95
|
+
spectra = results.get_cmb_power_spectra() # D_l in muK^2, columns TT, EE, BB, TE
|
|
96
|
+
lensed = spectra["lensed_scalar"] # shape (lmax + 1, 4)
|
|
97
|
+
phi_phi = spectra["lens_potential"][:, 0] # [L(L+1)]^2 C_L^phiphi / 2pi
|
|
98
|
+
|
|
99
|
+
p = pars.to_cosmo_params() # the same cosmology as a dictionary
|
|
100
|
+
bg = compute_background(p)
|
|
101
|
+
pk = compute_pk(bg, compute_thermodynamics(bg, p), p) # linear P(k, z), by default at z = 0
|
|
102
|
+
pk["k"], pk["P_k"][0], pk["sigma_8"][0] # k [1/Mpc], P(k) [Mpc^3], sigma_8
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The first call compiles the solver. Later calls reuse it. The package is quiet by default: `gravitax.set_verbose(True)`
|
|
106
|
+
(or `GRAVITAX_VERBOSE=1`) prints progress messages and the output of the GPU kernel builds. The CPU functions take
|
|
107
|
+
their numerical settings as keyword arguments; `gravitax.presets` bundles them into presets (see the
|
|
108
|
+
[documentation](https://eclipse-ai4science.github.io/gravitax/settings.html)).
|
|
109
|
+
|
|
110
|
+
### Nonlinear matter power spectrum
|
|
111
|
+
|
|
112
|
+
`compute_pk` applies a nonlinear model to the linear spectrum when asked: HMcode (`nonlinear="hmcode2020"` or
|
|
113
|
+
`"hmcode2016"`) or HALOFIT (`nonlinear="halofit"`: Takahashi et al. 2012 with the Bird et al. 2012 massive-neutrino
|
|
114
|
+
correction). HMcode needs the linear spectrum up to k = 100 h/Mpc, hence the larger `kmax` (in 1/Mpc):
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
pk_nl = compute_pk(bg, compute_thermodynamics(bg, p), p, kmax=70.0, nonlinear="hmcode2020")
|
|
118
|
+
pk_nl["P_nl"][0] # HMcode-2020 P(k) at z = 0 [Mpc^3]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Modified gravity
|
|
122
|
+
|
|
123
|
+
Departures from general relativity follow the (mu, Sigma) parametrisation: mu(a, k) modifies the Poisson
|
|
124
|
+
equation for Psi, and Sigma(a, k) the equation for the lensing potential Phi + Psi. Both are specified as
|
|
125
|
+
amplitudes of mu - 1 and Sigma - 1 on bins in ln a and ln k:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import numpy as np
|
|
129
|
+
from gravitax import compute_cls
|
|
130
|
+
|
|
131
|
+
mg = {"lna_edges": [np.log(1 / 4), np.log(1 / 2), 0.5], # z = 3 to 1, then z = 1 to today (last edge past a = 1)
|
|
132
|
+
"lnk_edges": np.log([1e-4, 0.03, 10.0]), # two scale bins, k in 1/Mpc
|
|
133
|
+
"mu_pix": [[0.1, 0.3], [0.2, -0.1]], # mu - 1, one row per time bin, one column per scale bin
|
|
134
|
+
"Sigma_pix": [[-0.05, 0.15], [0.1, 0.05]]} # Sigma - 1
|
|
135
|
+
q = {**p, "modified_gravity": mg}
|
|
136
|
+
bg_mg = compute_background(q)
|
|
137
|
+
cls_mg = compute_cls(bg_mg, compute_thermodynamics(bg_mg, q), q) # unlensed Dl_TT, Dl_EE, Dl_TE and Dl_pp
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Derivatives with respect to the bin amplitudes are available in the same way as for the cosmological parameters.
|
|
141
|
+
|
|
142
|
+
## Quick start on a GPU
|
|
143
|
+
|
|
144
|
+
`gpu_spectra` takes a batch of cosmologies as arrays and returns the lensed spectra for all of them. It runs at a
|
|
145
|
+
named setting (ODE tolerance, grids, output range), `setting="default"` unless you pass another;
|
|
146
|
+
`gravitax.gpu_api.available_settings()` lists them and the [settings page](https://eclipse-ai4science.github.io/gravitax/settings.html)
|
|
147
|
+
describes them.
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from gravitax import gpu_spectra
|
|
151
|
+
|
|
152
|
+
params = {"omega_b_h2": [0.02237, 0.02240], "omega_c_h2": [0.1200, 0.1195], "h": [0.6736, 0.6740],
|
|
153
|
+
"n_s": [0.9649, 0.9650], "A_s": [2.10e-9, 2.11e-9], "tau_reion": [0.0544, 0.0550]}
|
|
154
|
+
out = gpu_spectra(params) # a batch of two cosmologies
|
|
155
|
+
out["ell"] # 2 ... 2500
|
|
156
|
+
out["tt"], out["ee"], out["te"], out["pp"] # lensed D_l [muK^2] and lensing potential, shape (2, n_ell)
|
|
157
|
+
out["status"] # per-cosmology status
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`gpu_derivatives` returns the same spectra and their exact derivatives.
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from gravitax import gpu_derivatives
|
|
164
|
+
|
|
165
|
+
out = gpu_derivatives(params)
|
|
166
|
+
out["d_tt"] # shape (2, 5, n_ell): dD_l^TT along out["directions"]
|
|
167
|
+
out["directions"] # ("omega_b_h2", "omega_c_h2", "h", "logA", "n_s")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Here `logA` is ln(10^10 A_s). The keys `d_ee`, `d_te`, `d_pp` and `d_bb` hold the other spectra.
|
|
171
|
+
|
|
172
|
+
`gpu_pk_derivatives` returns the linear matter power spectrum at z = 0 with its derivatives along the same directions.
|
|
173
|
+
It runs at its own setting, so call it in a Python process of its own.
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from gravitax import gpu_pk_derivatives
|
|
177
|
+
|
|
178
|
+
pk = gpu_pk_derivatives(params)
|
|
179
|
+
pk["k"], pk["pk"] # k [1/Mpc] (400 values, 1e-4 to 1) and P(k) [Mpc^3], shape (2, 400)
|
|
180
|
+
pk["d_pk"] # shape (2, 5, 400): dP(k) along pk["directions"]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Derivatives
|
|
184
|
+
|
|
185
|
+
Every output comes with exact derivatives. On the GPU, `gpu_derivatives` returns the CMB spectra together with their
|
|
186
|
+
derivatives, and `gpu_pk_derivatives` the linear matter power spectrum with its derivatives (see above). The CPU functions can be differentiated directly with JAX: for example, the derivative of
|
|
187
|
+
sigma_8 with respect to omega_c h^2, continuing from the quick start:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
import jax
|
|
191
|
+
|
|
192
|
+
def sigma8_of(omch2):
|
|
193
|
+
q = {**p, "omega_c_h2": omch2}
|
|
194
|
+
bg = compute_background(q)
|
|
195
|
+
return compute_pk(bg, compute_thermodynamics(bg, q), q)["sigma_8"][0]
|
|
196
|
+
|
|
197
|
+
dsigma8_domch2 = jax.jacfwd(sigma8_of)(0.1200)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Documentation
|
|
201
|
+
|
|
202
|
+
- [Documentation](https://eclipse-ai4science.github.io/gravitax/): installation, quickstart, settings, API reference.
|
|
203
|
+
- [`examples/`](examples/): short scripts for the CMB spectra, P(k) with sigma_8, and exact gradients.
|
|
204
|
+
|
|
205
|
+
## Citation
|
|
206
|
+
|
|
207
|
+
If you use GRAVITAX, please cite:
|
|
208
|
+
|
|
209
|
+
- A. Spurio Mancini, *GRAVITAX: testing gravity with a differentiable Boltzmann code*, [arXiv:2612.06208](https://arxiv.org/abs/2612.06208).
|
|
210
|
+
- [gradsolve](https://github.com/ECLIPSE-AI4Science/gradsolve): A. Spurio Mancini, *GRADSOLVE: fast exact gradients for ODE ensembles on GPUs*, [arXiv:2609.02876](https://arxiv.org/abs/2609.02876).
|
|
211
|
+
|
|
212
|
+
GRAVITAX builds on the equations, conventions and methods of CAMB and CLASS; please cite:
|
|
213
|
+
|
|
214
|
+
- A. Lewis, A. Challinor and A. Lasenby, ApJ 538, 473 (2000), [astro-ph/9911177](https://arxiv.org/abs/astro-ph/9911177)
|
|
215
|
+
- A. Lewis, JCAP 10 (2026) 013, [arXiv:2607.14854](https://arxiv.org/abs/2607.14854)
|
|
216
|
+
- J. Lesgourgues, [arXiv:1104.2932](https://arxiv.org/abs/1104.2932)
|
|
217
|
+
- D. Blas, J. Lesgourgues and T. Tram, JCAP 07 (2011) 034, [arXiv:1104.2933](https://arxiv.org/abs/1104.2933)
|
|
218
|
+
|
|
219
|
+
If you use the nonlinear matter power spectrum, please cite HMcode:
|
|
220
|
+
|
|
221
|
+
- A. J. Mead et al., MNRAS 454, 1958 (2015), [arXiv:1505.07833](https://arxiv.org/abs/1505.07833)
|
|
222
|
+
- A. J. Mead et al., MNRAS 459, 1468 (2016), [arXiv:1602.02154](https://arxiv.org/abs/1602.02154)
|
|
223
|
+
- A. J. Mead et al., MNRAS 502, 1401 (2021), [arXiv:2009.01858](https://arxiv.org/abs/2009.01858)
|
|
224
|
+
|
|
225
|
+
or HALOFIT:
|
|
226
|
+
|
|
227
|
+
- R. E. Smith et al., MNRAS 341, 1311 (2003), [astro-ph/0207664](https://arxiv.org/abs/astro-ph/0207664)
|
|
228
|
+
- R. Takahashi et al., ApJ 761, 152 (2012), [arXiv:1208.2701](https://arxiv.org/abs/1208.2701)
|
|
229
|
+
- S. Bird, M. Viel and M. G. Haehnelt, MNRAS 420, 2551 (2012), [arXiv:1109.4416](https://arxiv.org/abs/1109.4416)
|
|
230
|
+
|
|
231
|
+
If you use mu and Sigma, please also cite the MGCAMB papers, whose parametrisation and conventions GRAVITAX follows:
|
|
232
|
+
|
|
233
|
+
- G.-B. Zhao et al., PRD 79, 083513 (2009), [arXiv:0809.3791](https://arxiv.org/abs/0809.3791)
|
|
234
|
+
- A. Hojjati, L. Pogosian and G.-B. Zhao, JCAP 08 (2011) 005, [arXiv:1106.4543](https://arxiv.org/abs/1106.4543)
|
|
235
|
+
- A. Zucca et al., JCAP 05 (2019) 001, [arXiv:1901.05956](https://arxiv.org/abs/1901.05956)
|
|
236
|
+
- Z. Wang et al., JCAP 08 (2023) 038, [arXiv:2305.05667](https://arxiv.org/abs/2305.05667)
|
|
237
|
+
|
|
238
|
+
GitHub's "Cite this repository" button reads [`CITATION.cff`](CITATION.cff).
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT. See [`LICENSE`](LICENSE).
|