FIRAS data (spectroxide.firas)#
Loads the COBE/FIRAS monopole spectrum, residuals, and the full 43 × 43
frequency-frequency covariance matrix from the LAMBDA archive into clean
numpy arrays. A FIRASData instance is the primary handle: its
attributes give the data itself, and its methods provide χ²-based
constraint utilities for downstream analysis (μ/y upper limits, joint
fits over a free CMB temperature, etc.).
Quick example#
from spectroxide.firas import FIRASData
firas = FIRASData()
# Loaded data
nu = firas.freq_ghz # frequency channels [GHz]
r = firas.residual_kJy # monopole residuals [kJy/sr]
C = firas.cov # full 43 × 43 covariance [(kJy/sr)²]
# χ² of an arbitrary intensity model against the residuals
chi2 = firas.chi2(model_kJy=my_model)
# 95 % CL upper limits on |μ| and y
mu_lim = firas.upper_limit_mu()
y_lim = firas.upper_limit_y()
Module-level upper limits#
Precomputed FIRAS constraints (Fixsen et al. 1996) exposed as constants
for quick use without constructing a FIRASData object.
Constant |
Value |
Meaning |
|---|---|---|
|
|
95 % CL upper limit on |
|
|
95 % CL upper limit on |
|
|
68 % CL (1σ) upper limit on |
|
|
68 % CL (1σ) upper limit on |
- spectroxide.firas.MU_FIRAS_95[source]#
Convert a string or number to a floating-point number, if possible.
- spectroxide.firas.Y_FIRAS_95[source]#
Convert a string or number to a floating-point number, if possible.
FIRASData#
FIRAS spectral-distortion constraints with full covariance matrix.
Provides χ² fitting of arbitrary spectral distortions against the COBE/FIRAS monopole residuals using the full 43 × 43 frequency-frequency covariance matrix from the LAMBDA archive.
Data sources#
From https://lambda.gsfc.nasa.gov/product/cobe/firas_products.html:
Monopole spectrum: Fixsen et al. 1996, ApJ 473, 576 (Table 4).
Covariance matrix: FIRAS_COVARIANCE_MATRIX_LOWF.FITS.
The per-pixel covariance is converted to a monopole covariance using the
correlation structure from the pixel covariance and the published
monopole 1-σ errors:
C_monopole_ij = σ_i σ_j corr_ij.
Usage#
>>> from spectroxide.firas import FIRASData
>>> firas = FIRASData()
>>> chi2 = firas.chi2(model_kJy) # χ² for a model in kJy/sr
>>> mu_limit = firas.upper_limit_mu() # 95% CL upper limit on |μ|
>>> result = firas.fit_distortion(delta_n_func) # joint (μ, y, ΔT/T) fit
- class spectroxide.firas.FIRASData[source]#
Bases:
objectFIRAS monopole data with full covariance matrix.
Loads the FIRAS monopole spectrum (43 frequency channels, 68–640 GHz) and the full frequency-frequency covariance matrix from the bundled data files.
- Parameters:
- Variables:
n_freq (int) – Number of frequency channels (43).
freq_cm (ndarray of float64) – Frequencies in cm⁻¹.
freq_ghz (ndarray of float64) – Frequencies in GHz.
x (ndarray of float64) – Dimensionless frequencies
x = h ν / (k_B T_CMB).spectrum_MJy (ndarray of float64) – Monopole spectrum in MJy/sr.
residual_kJy (ndarray of float64) – Residual monopole spectrum in kJy/sr.
sigma_kJy (ndarray of float64) – 1-σ diagonal uncertainties in kJy/sr.
galaxy_kJy (ndarray of float64) – Modelled high-latitude galactic spectrum in kJy/sr.
cov (ndarray, shape (43, 43)) – Full monopole covariance matrix in
(kJy/sr)².cov_inv (ndarray, shape (43, 43)) – Inverse covariance matrix in
(kJy/sr)⁻².corr (ndarray, shape (43, 43)) – Frequency-frequency correlation matrix (dimensionless).
Loaded data#
Attributes populated on construction. cov and cov_inv use the
full LAMBDA correlation matrix; sigma_kJy is the diagonal only.
Attribute |
Shape |
Description |
|---|---|---|
|
|
Number of frequency channels (43). |
|
|
Channel frequencies in cm⁻¹. |
|
|
Channel frequencies in GHz. |
|
|
Dimensionless |
|
|
Monopole spectrum in MJy/sr. |
|
|
Monopole residuals in kJy/sr (data minus reference blackbody). |
|
|
1-σ diagonal uncertainties in kJy/sr. |
|
|
Modelled high-latitude galactic spectrum in kJy/sr. |
|
|
Full monopole covariance in (kJy/sr)². |
|
|
Inverse covariance in (kJy/sr)⁻². |
|
|
Frequency-frequency correlation matrix (dimensionless). |
Constraint utilities#
Full-covariance χ² primitive plus the headline upper-limit and
joint-fit routines used in production. Additional helpers
(template-builders, amplitude fitters, Fisher-matrix utilities) exist
on FIRASData for ad-hoc analysis but are not part of the
documented surface.
Compute |
|
FIRAS upper limit on |
|
FIRAS upper limit on |
|
One-sided profile-likelihood upper limit with the CMB temperature floated. |
|
Joint fit of |
- FIRASData.chi2(model_kJy)[source]#
Compute
χ²of a model prediction against the FIRAS residuals.- Parameters:
model_kJy (array_like, shape (43,)) – Model prediction for the residual spectrum in kJy/sr.
- Returns:
float –
χ² = (r − m)ᵀ C⁻¹ (r − m).
- FIRASData.upper_limit_mu(cl=0.95, marginalise_y=True, marginalise_galactic=True)[source]#
FIRAS upper limit on
|μ|using the full covariance matrix.Marginalises over
G_bb(unobservable temperature shift). Optionally also marginalises overyand over the galactic dust nuisanceν² B_ν(T_dust)(Fixsen 1996 §6.1).- Parameters:
- Returns:
float – Upper limit on
|μ|at the given CL.
- FIRASData.upper_limit_y(cl=0.95, marginalise_mu=True, marginalise_galactic=True)[source]#
FIRAS upper limit on
|y|using the full covariance matrix.Marginalises over
G_bb(unobservable temperature shift). Optionally also marginalises overμand over the galactic dust nuisanceν² B_ν(T_dust)(Fixsen 1996 §6.1).- Parameters:
- Returns:
float – Upper limit on
|y|at the given CL.
- FIRASData.profile_limit_floating_T(template_dn_func, cl=0.95, t_range=None, marginalise_galactic=True, use_diagonal=False)[source]#
One-sided profile-likelihood upper limit with the CMB temperature floated.
Fits the model
I_obs(ν) − B(ν, T) = 4π ν³ A · 𝒯(x(T)) + G₀ · ν² B(ν, T_d)
to the 43 FIRAS monopole residuals using the full 43 × 43 covariance matrix. The first term on the RHS converts the occupation-number template
𝒯(supplied astemplate_dn_func) to specific intensity at amplitudeA. The second term is a galactic dust foreground following Fixsen et al. (1996); residual galactic emission is not perfectly subtracted from the FIRAS monopole and is partially degenerate with broadband distortion shapes, so whenmarginalise_galactic=True(default) we marginalise over a fixed-shapeν² B(ν, T_d)template withT_d = 9 Kand free amplitudeG₀.The CMB reference temperature
Tis itself a free parameter (it encodes the unobservable temperature shift), and both the residuals and the template shape𝒯(x(T))withx(T) = 2π ν / Tdepend nonlinearly onT. We therefore profile overTby scanning a grid aroundT₀; at eachTthe best-fitAandG₀are obtained analytically (the model is linear in both), and we take theTthat minimises χ². The one-sided 95% CL upper limit corresponds toΔχ² = 2.71on the profile likelihood ratio (Wilks’ theorem).- Parameters:
template_dn_func (callable) –
template_dn_func(x)returns Delta-n(x) per unit signal amplitude at dimensionless frequencies x = h*nu/(k*T).cl (float) – One-sided confidence level (default 0.95).
t_range (tuple of float, optional) – (T_min, T_max) search range for T [K]. Default: (2.720, 2.732), well within FIRAS precision.
marginalise_galactic (bool) – If True (default), profile over a galactic dust normalization G₀ with shape ν²·B_ν(T_dust). The dust template is independent of the trial T_CMB.
- Returns:
dict with keys –
- amplitudefloat
Best-fit signal amplitude at profiled T.
- sigmafloat
1-sigma uncertainty on amplitude.
- upper_limitfloat
One-sided upper limit on amplitude at given CL, clipped at zero.
- t_bestfloat
Best-fit blackbody temperature [K].
- chi2_minfloat
Minimum chi-squared (profiled over both A and T).
- FIRASData.fit_distortion(delta_n=None, model_kJy=None)[source]#
Joint fit of
(μ, y, ΔT/T)to FIRAS residuals or a model.Fits
ΔI = μ · M + y · Y + (ΔT/T) · G_bb(in kJy/sr).If
delta_nis provided, it is converted to kJy/sr and subtracted from the residual before fitting.If
model_kJyis provided, it is also subtracted.
- Parameters:
delta_n (callable or array_like, optional) – If callable,
delta_n(x)returnsΔnat the FIRAS frequencies. If array_like, shape (43,),Δnat the FIRAS frequencies. Default None.model_kJy (array_like, shape (43,), optional) – Additional model prediction in kJy/sr to subtract before fitting. Default None.
- Returns:
dict – Keys
mu,y,delta_t(floats, best-fit parameters),mu_sigma,y_sigma,delta_t_sigma(floats, 1-σ uncertainties),param_cov(ndarray, shape (3, 3)),chi2(float),ndof(int, 43 − 3 = 40), andpte(float, probability-to-exceed under the χ² null).