abcmb.main module

class abcmb.main.Model(user_species=None, **kwargs)[source]

Bases: Module

Model configuration and computation manager.

Creates instances of fluid species based on user input and organizes them for computation. Manages the full pipeline from background evolution through CMB power spectrum computation.

Attributes:

  • PE perturbations.PerturbationEvolver

    ABCMB perturbations module

  • SS spectrum.SpectrumSolver

    ABCMB spectrum module

  • RecModel hyrex.recomb_model

    HyRex recombination module

  • specs dict

    A dictionary of run options (expected to be static)

  • species_list tuple

    A list of all fluids in the user cosmology

  • species_dict dict

    A dictionary containing the names of all fluids, in the same order as they appear in species_list.

  • PArthENoPE_CLASS_table Array

    A 2D table for interpolation of the helium-4 mass fraction based on the user’s input baryon density and Neff

  • thermo_model_DNeff linx.BackgroundModel

    A LINX background model for BBN thermodynamics

  • abundanceModel linx.AbundanceModel

    A LINX abundance model used for computing the helium-4 mass fraction given the user’s input baryon density, Neff, neutron lifetime, and nuclear reaction rates.

  • adjoint diffrax.adjoint

    Adjoint mode for diffrax solves. Default is ForwardMode.

Methods:

  • __call__ :

    Compute CMB angular power spectra

  • get_PTBG :

    Get perturbation table and background cosmology

  • get_BG :

    Get background cosmology

  • add_derived_parameters :

    Compute derived parameters

get_BG(params: dict, pre_BG: BackgroundPreRecomb, recomb_output)[source]

Construct the full Background from pre-recomb + HyRex output.

Selects the reionization model (z-input vs tau-input) via lax.cond. NOT directly @eqx.filter_jit-decorated; called from inside _run_post_recomb (which is jit-wrapped).

Parameters:

  • params dict

    Cosmological parameters

  • pre_BG BackgroundPreRecomb

    Pre-recombination stage object.

  • recomb_output tuple

    HyRex output (xe, lna_xe, Tm, lna_Tm).

Returns:

background.Background

get_BG_pre_recomb(params: dict)[source]

Pre-recomb stage: tabulate conformal time and bundle H, T, nH for recombination.

Parameters:

  • params dict

    Cosmological parameters

Returns:

BackgroundPreRecomb

get_PTBG(params: dict, pre_BG: BackgroundPreRecomb, recomb_output)[source]

Get perturbation table and full Background.

Constructs the post-recomb Background from pre_BG + recomb_output and runs the perturbation evolver.

Parameters:

  • params dict

    Cosmological parameters

  • pre_BG BackgroundPreRecomb

    Pre-recombination stage object.

  • recomb_output tuple

    HyRex output (xe, lna_xe, Tm, lna_Tm).

Returns:

tuple

(PerturbationTable, Background)

run_cosmology_abbr(params: dict)[source]

Compute CMB angular power spectra for given parameters.

Runs the full pipeline from background evolution through perturbation integration to CMB power spectrum computation.

Parameters:

  • params dict

    Cosmological parameters (must already have derived keys).

Returns:

Output

CMB power spectra and friends.

class abcmb.main.Output(ClTT: array, ClTE: array, ClEE: array, Pk: array, l: array, k: array, BG: Background, PT: PerturbationTable, params: dict)[source]

Bases: Module

Object containing final and intermediate results from one cosmological simulation.

Attributes:

  • ClTT jnp.array

    Temperature-temperature power spectrum

  • ClTE jnp.array

    Temperature-polarization power spectrum

  • ClEE jnp.array

    Polarization-polarization power spectrum

  • Pk jnp.array

    Matter power spectrum

  • l jnp.array

    Multipoles l at which ClTT/ClTE/ClEE are output

  • k jnp.array

    Wavenumbers k at with Pk is output

  • BG background.Background

    Background object containing functions like Hubble, recombination history, etc

  • PT perturbations.PerturbationTable

    Perturbation table including perturbations for all fluids

  • params dict

    Complete parameter dictionary including derived parameters