API reference#
All functions are importable from the top-level classy_szlite namespace.
For runnable code + plots, see Tutorials & examples.
Parameter containers#
- class classy_szlite.CosmoParams(omega_b=0.02242, omega_cdm=0.11933, H0=67.66, tau_reio=0.054, ln10_10_As=3.047, n_s=0.9665, fEDE=0.001, log10z_c=3.562, thetai_scf=2.83, r=0.0, m_ncdm=0.02, N_ur=0.00441)[source]#
Bases:
NamedTupleCosmological parameters for the ede-v2 emulator suite.
Defaults give the LCDM-equivalent point (Planck 18 +
fEDE = 0.001).- Parameters:
- class classy_szlite.ProfileParamsA10(P0=8.13, c500=1.156, gamma=0.3292, alpha=1.062, beta=5.4807, B=1.0)[source]#
Bases:
NamedTupleArnaud 2010 gNFW pressure-profile parameters (for tSZ Cl^yy).
Bis the hydrostatic mass bias (B = M_true / M_HSE); the profile is evaluated at the effective M_HSE = M_true / B and r_500c_HSE = r_500c_true / B^(1/3).- Parameters:
Derived parameters#
- classy_szlite.derived(cosmo)[source]#
Derived parameters:
sigma_8,Omega_m,S8.Also returns the full 17-element DER emulator output as
'der_full'(σ8 is at index 1; consult the CosmoPower DER training script for the full list).- Parameters:
cosmo (CosmoParams)
- Return type:
The der_full array contains 17 entries from the ede-v2 DER emulator
(index 0 = \(h\), index 1 = \(\sigma_8\), index 2 = \(\Omega_m\), etc.).
CMB angular power spectra#
- classy_szlite.cl_TTTEEE(cosmo, spectra=('tt', 'te', 'ee'), ell_factor=True)[source]#
CMB angular power spectra.
Returns a dict with keys
'ell'and the requested spectra ('tt','te','ee'). Values are dimensionless — multiply byTcmb_uK² = (2.7255e6)²to convert to μK².ell_factor(defaultTrue) — returnD_ell = ell(ell+1) Cl / (2π);Falsereturns raw Cl.- Parameters:
cosmo (CosmoParams)
ell_factor (bool)
- Return type:
The default output is \(D_\ell = \ell(\ell+1)C_\ell/(2\pi)\) in units of \(T_{\rm CMB}^2\) — multiply by \(T_{\rm CMB}^2 = (2.7255\times10^6\,\mu{\rm K})^2\) to get \(\mu{\rm K}^2\).
Matter power spectrum#
- classy_szlite.Pk(cosmo, z_arr)[source]#
Linear P(k, z) — returns
(k, pk(z, k)).- Parameters:
cosmo (CosmoParams)
- classy_szlite.Pnl(cosmo, z_arr)[source]#
Non-linear P(k, z) (HMcode) — returns
(k, pk(z, k)).- Parameters:
cosmo (CosmoParams)
Distances#
- classy_szlite.distances(cosmo, z_arr)[source]#
Returns
(Hz, chi, Da).Hzis H(z)/c in 1/Mpc; distances in Mpc.- Parameters:
cosmo (CosmoParams)
Returns Hz / c in \(1/\mathrm{Mpc}\) (multiply by \(c=299\,792.458\) km/s
for \(H(z)\) in km/s/Mpc), \(\chi(z)\) in Mpc, and \(D_A(z)=\chi(z)/(1+z)\) in Mpc.
Halo-model tSZ Cl^yy#
- classy_szlite.cl_yy(cosmo, profile, ell, z_grid=None, n_z=100, m_min=10000000000.0, m_max=3500000000000000.0, n_m=200, delta_crit=500.0)[source]#
Halo-model tSZ angular power spectrum (full pipeline per call).
Returns
(cl_1h, cl_2h)— dimensionless C_ell. Multiply byell*(ell+1)/(2π)*1e12to getD_ell × 1e12.For MCMC sampling only profile parameters at fixed cosmology, use
cl_yy_factory()instead — ~3× faster.- Parameters:
cosmo (CosmoParams)
profile (ProfileParamsA10)
z_grid (Array | None)
n_z (int)
m_min (float)
m_max (float)
n_m (int)
delta_crit (float)
- classy_szlite.cl_yy_factory(cosmo, ell, z_grid=None, n_z=100, m_min=10000000000.0, m_max=3500000000000000.0, n_m=200, delta_crit=500.0)[source]#
Fixed-cosmology fast-path: precompute the heavy bits, get a closure.
Builds
CosmoGrids(emulators → P_lin, distances, σ(R)) andHaloGrids(Tinker 08 HMF, bias) once, then returns:ev(profile) -> (cl_1h, cl_2h)
A subsequent
ev(profile)call only runs thecl_yy_1h_2hhalo-model integration — typically ~5 ms per call. Intended for MCMC over profile / nuisance parameters with fixed cosmology.
See the convergence study for the dependence on \(n_z\), \(n_M\), \(M_{\rm min}\), \(M_{\rm max}\).
Utility#
- classy_szlite.cosmo_to_dict(cosmo)[source]#
Convert
CosmoParamsto the emulator-style dict (with curly-brace key).Values pass through as-is (float or jax.Array) so the returned dict is JAX-traceable — pass a
CosmoParamsof tracers tojax.grad.- Parameters:
cosmo (CosmoParams)
- Return type: