Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CosmoComputationError on python3.8.8 #585

Open
deyanmihaylov opened this issue Aug 3, 2024 · 0 comments
Open

CosmoComputationError on python3.8.8 #585

deyanmihaylov opened this issue Aug 3, 2024 · 0 comments

Comments

@deyanmihaylov
Copy link

On python3.8.8 I am trying the following beginners script

from classy import Class

#Start by specifying the cosmology
Omega_b = 0.05
Omega_m = 0.3
Omega_cdm = Omega_m - Omega_b
h = 0.7 #H0/100
A_s = 2.1e-9
n_s = 0.96

#Create a params dictionary
#Need to specify the max wavenumber
k_max = 10 #UNITS: 1/Mpc

params = {
             'output':'mPk',
             'non linear':'halofit',
             'Omega_b':Omega_b,
             'Omega_cdm':Omega_cdm,
             'h':h,
             'A_s':A_s,
             'n_s':n_s,
             'P_k_max_1/Mpc':k_max,
             'z_max_pk':10. #Default value is 10
}

#Initialize the cosmology andcompute everything
cosmo = Class()
cosmo.set(params)
cosmo.compute()

#Specify k and z
k = np.logspace(-5, np.log10(k_max), num=1000) #Mpc^-1
z = 1.

#Call these for the nonlinear and linear matter power spectra
Pnonlin = np.array([cosmo.pk(ki, z) for ki in k])
Plin = np.array([cosmo.pk_lin(ki, z) for ki in k])

# NOTE: You will need to convert these to h/Mpc and (Mpc/h)^3
# to use in the toolkit. To do this you would do:
k /= h
Plin *= h**3
Pnonlin *= h**3

which gives the following error

---------------------------------------------------------------------------
CosmoComputationError                     Traceback (most recent call last)
Cell In[4], line 30
     28 cosmo = Class()
     29 cosmo.set(params)
---> 30 cosmo.compute()
     32 #Specify k and z
     33 k = np.logspace(-5, np.log10(k_max), num=1000) #Mpc^-1

File ~/Documents/Work/CompactCollab/CorrelationMatrices/.venv/lib/python3.8/site-packages/class_public/python/classy.pyx:391, in classy.Class.compute()

CosmoComputationError: 

Error in Class: thermodynamics_init(L:344) :error in thermodynamics_helium_from_bbn(ppr,pba,pth);
=>thermodynamics_helium_from_bbn(L:589) :could not open fA with name /Users/deyanmihaylov/Library/Python/3.8/lib/python/site-packages/class_public/external/bbn/sBBN_2017.dat and mode "r"

I checked and the file does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant