lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
220 stars 291 forks source link

Different derived cosmological parameters between CLASS versions #519

Open epaillas opened 1 year ago

epaillas commented 1 year ago

Hello - I'm currently using CLASS to derive the values of A_s and h under LCDM, given that we know the values of omega_b, omega_cdm, sigma_8 and n_s, and also assuming that the angular size of the sound horizon is fixed.

from classy import Class
import numpy as np

def abacus_derived_params(params):
    """Get derived h and A_s from input AbacusSummit
    parameters omega_b, omega_cdm, sigma8, n_s"""
    Abacus_LCDM ={
        'omega_b': params[0],
        'omega_cdm': params[1],
        'sigma8': params[2],
        'n_s': params[3],
        'N_ur': 2.0328,
        'N_ncdm' : 1.0,
        'omega_ncdm' : 0.0006442,
        '100*theta_s' : 1.041533, #from Summit paper
        'recombination' : 'HyRec',
        'tau_reio' : 0.0544,
        'output': 'mPk', #which quantities we want CLASS to compute
        'z_pk' : 1.0,
        'non linear' : 'none',
        'P_k_max_1/Mpc':10.0 # CLASS uses 1/Mpc units
    }
    cosmo = Class();
    cosmo.set(Abacus_LCDM)
    cosmo.compute()
    print("\tderived:",cosmo.get_current_derived_parameters(['A_s','h']))
    return

# input omega_b, omega_cdm, sigma8, n_s
abacus_cosmo = [0.02237, 0.1200, 0.711201, 0.9649]
abacus_derived_params(abacus_cosmo)

The issue is that the results vary a lot depending on the CLASS version I'm using. With CLASS v2.9, the output of the code above is derived: {'A_s': 2.0447e-09, 'h': 0.6982072}, while for CLASS v3.20, I'm getting derived: {'A_s': 2.069916538740538e-09, 'h': 0.6781}. In fact, for CLASS v3.20, there seems to be something more strange going on, because no matter what the values of the input parameters are, I always get a derived h = 0.6781.

The result from CLASS v2.9 seems accurate, as I have compared it against the table of cosmologies from AbacusSummit (https://abacussummit.readthedocs.io/en/latest/cosmologies.html), so I'll be using that for the time being, but I'd like to understand what's the underlying cause of this issue, since this seems to be a significant change in background evolution. Thanks a lot in advance!