API Reference
Blackbody Physics Functions
CMBForegrounds.dimensionless_freq_vars — Functiondimensionless_freq_vars(ν, ν0, T)Calculates dimensionless frequency variables used in blackbody-related calculations.
The variables are defined as:
- $r = \nu / \nu_0$
- $x = \frac{h\nu}{k_B T}$
- $x_0 = \frac{h\nu_0}{k_B T}$
where $h$ is the Planck constant and $k_B$ is the Boltzmann constant.
Arguments
ν: Frequency in GHzν0: Reference frequency in GHzT: Temperature in Kelvin
Returns
- A tuple
(r, x, x0)containing the dimensionless variables
CMBForegrounds.Bnu_ratio — FunctionBnu_ratio(ν, ν0, T)Computes the ratio of Planck blackbody intensities at two frequencies.
The Planck function ratio is:
\[\frac{B(\nu, T)}{B(\nu_0, T)} = \left(\frac{\nu}{\nu_0}\right)^3 \frac{\exp(h\nu_0/k_B T) - 1}{\exp(h\nu/k_B T) - 1}\]
Arguments
ν: Frequency in GHzν0: Reference frequency in GHzT: Temperature in Kelvin
Returns
- Dimensionless ratio
B(ν, T) / B(ν0, T)
CMBForegrounds.dBdT_ratio — FunctiondBdT_ratio(ν, ν0, T)Computes the ratio of blackbody temperature derivatives at two frequencies.
The derivative ratio is:
\[\frac{\partial B(\nu, T)/\partial T}{\partial B(\nu_0, T)/\partial T} = \left(\frac{\nu}{\nu_0}\right)^4 \frac{x_0^2 \exp(x_0)/(\exp(x_0) - 1)^2}{x^2 \exp(x)/(\exp(x) - 1)^2}\]
where $x = h\nu/(k_B T)$ and $x_0 = h\nu_0/(k_B T)$.
Arguments
ν: Frequency in GHzν0: Reference frequency in GHzT: Temperature in Kelvin
Returns
- Dimensionless ratio
(∂B/∂T)(ν, T) / (∂B/∂T)(ν0, T)
Thermal Sunyaev-Zel'dovich Functions
CMBForegrounds.tsz_g_ratio — Functiontsz_g_ratio(ν, ν0, T)Calculates the spectral shape of the thermal Sunyaev-Zel'dovich (tSZ) effect.
The tSZ spectral function is:
\[g(x) = x \coth\left(\frac{x}{2}\right) - 4\]
where $x = h\nu/(k_B T)$. This function returns $g(x) / g(x_0)$.
Arguments
ν: Frequency in GHzν0: Reference frequency in GHzT: CMB temperature in Kelvin
Returns
- Dimensionless ratio
g(ν) / g(ν0)of tSZ spectral function
CMBForegrounds.tsz_cross_power — Functiontsz_cross_power(template, A_tSZ, ν1, ν2, ν0, α_tSZ, ℓ_pivot, ℓs; T_CMB=T_CMB)Computes the thermal Sunyaev-Zel'dovich cross-power spectrum.
The tSZ power spectrum is:
\[D_\ell^{\mathrm{tSZ}}(\nu_1, \nu_2) = A_{\mathrm{tSZ}} \cdot g(\nu_1) \cdot g(\nu_2) \cdot T(\ell) \cdot \left(\frac{\ell}{\ell_{\mathrm{pivot}}}\right)^{\alpha_{\mathrm{tSZ}}}\]
where $T(\ell)$ is the template and $g(\nu)$ is the tSZ spectral function.
Arguments
template: tSZ power spectrum templateDℓat reference frequencyA_tSZ: tSZ amplitude at pivot scaleν1,ν2: Frequencies in GHz of correlated channelsν0: Reference frequency in GHzα_tSZ: Power-law tilt of tSZ spectrumℓ_pivot: Pivot multipole for power-law scalingℓs: Multipoles for computation
Keywords
T_CMB=T_CMB: CMB temperature in Kelvin
Returns
- tSZ cross-power spectrum
Dℓ
CMBForegrounds.tsz_cib_cross_power — Functiontsz_cib_cross_power(ℓs, ξ, A_tSZ, A_CIB, α, β, z1, z2, ν_cib1, ν_cib2, ν_tsz1, ν_tsz2, α_tsz, tsz_template, ν0_tsz, Tdust, ν0_cib; ℓ_pivot_cib=3000, ℓ_pivot_tsz=3000, T_CMB=T_CMB)Computes the cross-correlation between thermal SZ and cosmic infrared background.
The tSZ-CIB cross-power spectrum is:
\[D_\ell^{\mathrm{tSZ \times CIB}} = -\xi \left( \sqrt{|D_\ell^{\mathrm{tSZ,11}} \cdot D_\ell^{\mathrm{CIB,22}}|} + \sqrt{|D_\ell^{\mathrm{tSZ,22}} \cdot D_\ell^{\mathrm{CIB,11}}|} \right)\]
where $\xi$ is the correlation coefficient and auto-spectra are computed for each component.
Arguments
ℓs: Vector of multipoles.ξ: tSZ-CIB correlation coefficient.A_tSZ,A_CIB: Amplitudes for the tSZ and CIB power spectra.α,β: Power-law indices for the CIB model.z1,z2: Redshifts for the CIB channels.ν_cib1,ν_cib2: Frequencies for the CIB channels.ν_tsz1,ν_tsz2: Frequencies for the tSZ channels.α_tsz: The power-law tilt of the tSZ power spectrum.tsz_template: Power spectrum template for the tSZ effect.ν0_tsz,ν0_cib: Reference frequencies for the tSZ and CIB models.Tdust: Dust temperature for the CIB model.
Keywords
ℓ_pivot_cib: Pivot multipole for the CIB power spectrum; default is 3000.ℓ_pivot_tsz: Pivot multipole for the tSZ power spectrum; default is 3000.T_CMB: Temperature of the CMB.
Returns
- An
AbstractVectorof the tSZ-CIB cross-power spectrumDℓ.
CIB and Dust Functions
CMBForegrounds.cib_mbb_sed_weight — Functioncib_mbb_sed_weight(β, Tdust, ν0, ν; T_CMB=T_CMB)Calculates the spectral energy distribution weight for modified blackbody emission.
The CIB modified blackbody SED weight is:
\[S(\nu) = \left(\frac{\nu}{\nu_0}\right)^\beta \frac{B(\nu, T_\mathrm{dust})}{B(\nu_0, T_\mathrm{dust})} \frac{(\partial B/\partial T)(\nu_0, T_\mathrm{CMB})}{(\partial B/\partial T)(\nu, T_\mathrm{CMB})}\]
where $B(\nu, T)$ is the Planck function and $\beta$ is the dust emissivity index.
Arguments
β: Dust emissivity spectral indexTdust: Dust temperature in Kelvinν0: Reference frequency in GHzν: Evaluation frequency in GHz
Keywords
T_CMB=T_CMB: CMB temperature in Kelvin
Returns
- Dimensionless SED weight
CMBForegrounds.dust_tt_power_law — Functiondust_tt_power_law(ℓs, A_pivot, α, β, ν1, ν2, Tdust, ν0; ℓ_pivot=80, T_CMB=T_CMB)Computes thermal dust power spectrum using a power-law model.
The dust power spectrum is:
\[D_\ell^{\mathrm{dust}}(\nu_1, \nu_2) = A_{\mathrm{pivot}} \cdot S(\nu_1) \cdot S(\nu_2) \cdot \left(\frac{\ell}{\ell_{\mathrm{pivot}}}\right)^{\alpha + 2}\]
where $S(\nu)$ is the modified blackbody SED weight and the $+2$ converts from $C_\ell$ to $D_\ell$ scaling.
Arguments
ℓs: Multipoles vectorA_pivot: Amplitude at pivot multipoleα: Power-law index for multipole dependenceβ: Dust emissivity spectral indexν1,ν2: Frequencies in GHz for cross-correlationTdust: Dust temperature in Kelvinν0: Reference frequency in GHz
Keywords
ℓ_pivot=80: Pivot multipoleT_CMB=T_CMB: CMB temperature
Returns
- Dust power spectrum
Dℓ
CMBForegrounds.cib_clustered_power — Functioncib_clustered_power(ℓs, A_CIB, α, β, ν1, ν2, z1, z2, Tdust, ν0_cib; ℓ_pivot=3000, T_CMB=T_CMB)Computes the clustered cosmic infrared background power spectrum.
The CIB clustered power spectrum is:
\[D_\ell^{\mathrm{CIB}}(\nu_1, \nu_2) = A_{\mathrm{CIB}} \cdot S(\nu_1) \cdot S(\nu_2) \cdot \sqrt{z_1 z_2} \cdot \left(\frac{\ell}{\ell_{\mathrm{pivot}}}\right)^\alpha\]
where $S(\nu)$ are the modified blackbody SED weights and $z_i$ are redshift factors.
This function handles both auto-spectra (when ν1=ν2 and z1=z2) and cross-spectra.
Arguments
ℓs: AnAbstractVectorof multipoles.A_CIB: Amplitude of the CIB power spectrum at the pivot multipole.α: Power-law index for the multipole dependence.β: Spectral index for the dust emissivity (modified blackbody).ν1: First frequency in GHz.ν2: Second frequency in GHz.z1: First redshift factor (related to flux normalization).z2: Second redshift factor (related to flux normalization).Tdust: Dust temperature in Kelvin.ν0_cib: Reference frequency for the CIB SED in GHz.
Keywords
ℓ_pivot: Pivot multipole where amplitude is defined, default is 3000.T_CMB: Temperature of the CMB in Kelvin, default is T_CMB constant.
Returns
- An
AbstractVectorcontaining the CIB clustered power spectrumD_ℓat eachℓinℓs.
Examples
# Auto-spectrum at 353 GHz
D_ℓ_auto = cib_clustered_power(ℓs, 1.0, 0.8, 1.6, 353.0, 353.0, 1.0, 1.0, 25.0, 150.0)
# Cross-spectrum between 217 and 353 GHz
D_ℓ_cross = cib_clustered_power(ℓs, 1.0, 0.8, 1.6, 217.0, 353.0, 0.9, 1.1, 25.0, 150.0)Other Foreground Functions
CMBForegrounds.ksz_template_scaled — Functionksz_template_scaled(template, AkSZ)Scales a kinematic Sunyaev-Zel'dovich (kSZ) power spectrum template by a given amplitude.
Arguments
template: AnAbstractVectorrepresenting the kSZ power spectrum shapeDℓ.AkSZ: The amplitude scaling factor.
Returns
- An
AbstractVectorcontaining the scaled kSZ power spectrum.
Response and Utility Functions
CMBForegrounds.ssl_response — Functionssl_response(ℓs, κ, Dℓ)Calculates the super-sample lensing response in the power spectrum.
The SSL response is:
\[\Delta D_\ell^{\mathrm{SSL}} = -\kappa \left[ \ell \frac{\ell(\ell+1)}{2\pi} \frac{\mathrm{d}C_\ell}{\mathrm{d}\ell} + 2 D_\ell \right]\]
where $\kappa$ is the convergence field and $C_\ell = D_\ell \cdot 2\pi/[\ell(\ell+1)]$.
Arguments
ℓs: Multipoles vectorκ: Convergence field valueDℓ: Unperturbed power spectrum
Returns
- Change in power spectrum due to SSL
CMBForegrounds.aberration_response — Functionaberration_response(ℓs, ab_coeff, Dℓ)Calculates the relativistic aberration response in the power spectrum.
The aberration response is:
\[\Delta D_\ell^{\mathrm{aberr}} = -A_{\mathrm{aberr}} \cdot \ell \frac{\ell(\ell+1)}{2\pi} \frac{\mathrm{d}C_\ell}{\mathrm{d}\ell}\]
where $A_{\mathrm{aberr}}$ is the aberration coefficient related to observer velocity.
Arguments
ℓs: Multipoles vectorab_coeff: Aberration coefficientDℓ: Unperturbed power spectrum
Returns
- Change in power spectrum due to aberration
CMBForegrounds.gaussian_beam_window — Functiongaussian_beam_window(fwhm_arcmin, ells)Calculates the Gaussian beam window function.
The beam window function is:
\[B_\ell = \exp\left(-\frac{1}{2} \ell(\ell + 1) \sigma^2\right)\]
where $\sigma = \mathrm{FWHM} / \sqrt{8 \ln 2}$ is the beam standard deviation in radians.
Arguments
fwhm_arcmin: Beam FWHM in arcminutesells: Multipoles vector
Returns
- Beam window function values
CMBForegrounds.fwhm_arcmin_to_sigma_rad — Functionfwhm_arcmin_to_sigma_rad(fwhm_arcmin)Converts a beam's Full-Width at Half-Maximum (FWHM) from arcminutes to its standard deviation (sigma) in radians.
Arguments
fwhm_arcmin: The FWHM in units of arcminutes.
Returns
- The beam sigma in units of radians.
CMBForegrounds.shot_noise_power — Functionshot_noise_power(ℓs, A_ℓ0; ℓ0=3000)Computes shot noise power spectrum with ℓ² scaling.
The shot noise power spectrum is:
\[D_\ell^{\mathrm{shot}} = A_{\ell_0} \left(\frac{\ell}{\ell_0}\right)^2\]
This represents the white noise contribution from point sources.
Arguments
ℓs: Multipoles vectorA_ℓ0: Shot noise amplitude at reference multipole
Keywords
ℓ0=3000: Reference multipole
Returns
- Shot noise power spectrum
Dℓ
CMBForegrounds.dCl_dell_from_Dl — FunctiondCl_dell_from_Dl(ℓs, Dℓ)Calculates the derivative of the angular power spectrum.
Converts from $D_\ell$ to $C_\ell$ derivative using:
\[\frac{\mathrm{d}C_\ell}{\mathrm{d}\ell} = \frac{\mathrm{d}}{\mathrm{d}\ell}\left[D_\ell \frac{2\pi}{\ell(\ell+1)}\right]\]
The derivative is computed using central differences for interior points.
Arguments
ℓs: Multipoles vectorDℓ: Power spectrumD_\ellvalues
Returns
- Derivative
dCℓ/dℓ
CMBForegrounds.cross_calibration_mean — Functioncross_calibration_mean(cal1, cal2, cal3, cal4)Calculates the mean of two cross-calibration products. This is a simple utility function, often used for combining calibration factors from different frequency maps.
Arguments
cal1,cal2,cal3,cal4: Calibration factors.
Returns
- The mean value:
(cal1 * cal2 + cal3 * cal4) / 2.
Constants
CMBForegrounds.T_CMB — ConstantT_CMBThe temperature of the Cosmic Microwave Background in Kelvin (2.72548 K).
CMBForegrounds.h — ConstanthPlanck's constant in J⋅s (6.62606957×10⁻³⁴ J⋅s).
CMBForegrounds.kB — ConstantkBBoltzmann constant in J/K (1.3806488×10⁻²³ J/K).
CMBForegrounds.Ghz_Kelvin — ConstantGhz_KelvinConversion factor h/kB × 10⁹ for converting between frequency (GHz) and temperature (K).
Index
CMBForegrounds.Ghz_KelvinCMBForegrounds.T_CMBCMBForegrounds.hCMBForegrounds.kBCMBForegrounds.Bnu_ratioCMBForegrounds.aberration_responseCMBForegrounds.cib_clustered_powerCMBForegrounds.cib_mbb_sed_weightCMBForegrounds.cross_calibration_meanCMBForegrounds.dBdT_ratioCMBForegrounds.dCl_dell_from_DlCMBForegrounds.dimensionless_freq_varsCMBForegrounds.dust_tt_power_lawCMBForegrounds.fwhm_arcmin_to_sigma_radCMBForegrounds.gaussian_beam_windowCMBForegrounds.ksz_template_scaledCMBForegrounds.shot_noise_powerCMBForegrounds.ssl_responseCMBForegrounds.tsz_cib_cross_powerCMBForegrounds.tsz_cross_powerCMBForegrounds.tsz_g_ratio