Module spectrum

Source
Expand description

Spectral shapes and distributions for CMB spectral distortions.

All functions here take the dimensionless frequency x = hν/(kT_z) and return an occupation-number perturbation Δn. They are normalized so that the corresponding distortion amplitude (μ, y, ΔT/T) is the coefficient that multiplies the shape — e.g. Δn_μ(x) = μ · M(x), Δn_y(x) = y · Y_SZ(x), Δn_T(x) = (ΔT/T) · G_bb(x).

Provided shapes:

  • planck — equilibrium blackbody n_pl(x) = 1/(e^x − 1) (small-x and large-x branches preserve precision).
  • bose_einstein1/(e^{x+μ} − 1), the chemical-potential family.
  • mu_shape — μ-distortion shape M(x) (Sunyaev-Zel’dovich 1970).
  • y_shape — y-distortion shape Y_SZ(x) (Zeldovich-Sunyaev 1969).
  • temperature_shift_shapeG_bb(x) = x e^x / (e^x − 1)², the temperature-shift mode δT/T.

Conventions match those used by crate::greens and the Python spectroxide.greens module so PDE and Green’s-function results can be decomposed against the same basis.

Functions§

bose_einstein
Bose-Einstein distribution: n_BE(x, μ) = 1/(e^(x+μ) - 1)
compton_equilibrium_ratio
Compute the Compton equilibrium temperature ratio T_e^eq / T_z from the photon spectrum.
delta_n_over_n
Compute fractional photon number change: ΔN/N = ∫x² Δn dx / G₂
delta_rho_over_rho
Compute fractional energy in distortion: Δρ/ρ = ∫x³ Δn dx / G₃
g_bb
Blackbody derivative: G_bb(x) = x e^x / (e^x - 1)² This is -x ∂n_pl/∂x = x²/(4T) ∂B_ν/∂T normalized
mu_shape
μ-distortion spectral shape: M(x) = (x/β_μ - 1) · e^x / (e^x - 1)²
planck
Planck (blackbody) occupation number: n_pl(x) = 1/(e^x - 1)
spectral_integral
Numerical integral of x^n * n_pl(x) over [0, x_max] using the trapezoidal rule on a logarithmic grid. Used for validation against analytic G_n values.
y_shape
Y-distortion (Sunyaev-Zeldovich) spectral shape: Y_SZ(x) = G_bb(x) · [x·coth(x/2) - 4]