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)
218 stars 291 forks source link

DE equation of state inside wrapper not working #537

Open ClaudioNahmad opened 11 months ago

ClaudioNahmad commented 11 months ago

Hello,

I'm having a small problem involving a fluid equation of state, in particular a DE eos. I tried to plot some basic plots using the classy wrapper via a jupyter notebook. Using class v. 3.2.0.

First i tried LCDM, in this way:

#Lambda CDM
LCDM = Class()
LCDM.set({'Omega_cdm':0.25,'Omega_b':0.05})
LCDM.compute()

And then obtained parameters, and plotted succesfully (i wont be putting those here, for the sake of clarity)

Then i tried an EoS i succesfully added into CLASS which works ok, and even MontePython reads it and runs ok. But as soon as i tried to declare some basic parameters inside classy, it didnt detect it:


#b0b1b2
b0b1b2 = Class()
b0b1b2.set({'Omega_cdm':0.25,'Omega_b':0.05,'Omega_fld':0})
b0b1b2.set({'b0_fld':-0.91})
b0b1b2.compute()

with the following output:

CosmoSevereError                          Traceback (most recent call last)
Input In [5], in <cell line: 4>()
      2 b0b1b2.set({'Omega_cdm':0.25,'Omega_b':0.05,'Omega_fld':0})
      3 b0b1b2.set({'b0_fld':-0.91})
----> 4 b0b1b2.compute()

File classy.pyx:372, in classy.Class.compute()

CosmoSevereError: 

Error in Class: Class did not read input parameter(s): b0_fld

Ok, so maybe CLASS is not detecting MY equation of state, what if i run CPL, that is coded into CLASS? Let's see:

#w0waCDM (CPL)
w0wa = Class()
w0wa.set({'Omega_cdm':0.25,'Omega_b':0.05,'w0_fld':-0.91})
w0wa.compute()

Output:

---------------------------------------------------------------------------
CosmoSevereError                          Traceback (most recent call last)
/tmp/ipykernel_132642/2290948436.py in <module>
      2 w0wa = Class()
      3 w0wa.set({'Omega_cdm':0.25,'Omega_b':0.05,'w0_fld':-0.91})
----> 4 w0wa.compute()
      5 #data.cosmo_arguments['fluid_equation_of_state'] = 'b0b1b2'

classy.pyx in classy.Class.compute()

CosmoSevereError: 

Error in Class: Class did not read input parameter(s): w0_fld

so... maybe i didn't declare explicitly that im using an EoS, so i proceed and do it:

#w0waCDM (CPL)
w0wa = Class()
w0wa.set({'Omega_cdm':0.25,'Omega_b':0.05,'w0_fld':-0.91,'fluid_equation_of_state':'CLP'})
w0wa.compute()
#data.cosmo_arguments['fluid_equation_of_state'] = 'b0b1b2'

and still, nothing:

---------------------------------------------------------------------------
CosmoSevereError                          Traceback (most recent call last)
/tmp/ipykernel_132642/59508372.py in <module>
      2 w0wa = Class()
      3 w0wa.set({'Omega_cdm':0.25,'Omega_b':0.05,'w0_fld':-0.91,'fluid_equation_of_state':'CLP'})
----> 4 w0wa.compute()
      5 #data.cosmo_arguments['fluid_equation_of_state'] = 'b0b1b2'

classy.pyx in classy.Class.compute()

CosmoSevereError: 

Error in Class: Class did not read input parameter(s): w0_fld, fluid_equation_of_state

Im sure i'm not doing it correctly, any ideas? Thanks in advance!

Hayyim-H commented 10 months ago

You need to declare Omega_fld>0