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

Could not find sBBN_2017.dat #364

Open
Kshitizpandey123 opened this issue Mar 11, 2024 · 7 comments
Open

Could not find sBBN_2017.dat #364

Kshitizpandey123 opened this issue Mar 11, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Kshitizpandey123
Copy link

I am trying to run this command:
$ python2.7 montepython/MontePython.py run -o test -p example.param
But It every time it gives this error:
Error in Class: thermodynamics_init(L:342) :error in thermodynamics_helium_from_bbn(ppr,pba,pth);
=>thermodynamics_helium_from_bbn(L:545) :could not open fA with name /home/kshitiz/class/external/bbn/sBBN_2017.dat and mode "r"
10 1e+30 2.251788e+00 1.124584e-01 9.687692e-01 2.401819e+00 7.107870e-01 9.115225e-02 0.000000e+00 0.000000e+00

10 steps done, acceptance rate: 0.0

/!\ The acceptance rate is below 0.05. You might want to set the jumping factor
to a lower value than the default (2.4), with the option -f 1.5 for
instance.
I also tried to include this line in the example.param file:
data.cosmo_arguments['sBBN file'] = '/home/MY_PC/class_public-3.2.3/external/bbn/sBBN_2017.dat'
but it still gives the same error.

@Kshitizpandey123
Copy link
Author

I am worried specifically about this line:
=>thermodynamics_helium_from_bbn(L:545) :could not open fA with name /home/kshitiz/class/external/bbn/sBBN_2017.dat and mode "r"
pls suggest how to deal with it

@brinckmann
Copy link
Owner

Hi,

Depending on your class version the BBN files have two different locations that you should specify through your input param file.

For newer class versions you need e.g.:
data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/external/bbn/sBBN_2017.dat '

For older class versions you need (if I remember correctly) e.g.:
data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/bbn/sBBN_2017.dat '

Or change the path to whatever the correct path is if these don't work. Look in your class directory to find the BBN files. For newer CLASS versions you find them in your_class/external/bbn/ and for older CLASS versions I think it was your_class/bbn/ . Note there are three different BBN files to choose from.

Best,
Thejs

@Kshitizpandey123
Copy link
Author

Grateful for your quick reply.

I had created a default.conf file with these lines in them:
path['cosmo'] = '/home/kshitiz/class_public-3.2.3'
path['clik'] = '/home/kshitiz/montepython_public/code/plc_3.0/plc-3.01'

And as you said, in the example.param file, I added following line:
data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/external/bbn/sBBN_2017.dat'
(since I am using version 3.2.3)

But now it generates the following error msg, something about HyRec2020:

**** ERROR HAS OCCURRED in HYREC-2 ****
in allocate_and_read_atomic: could not open file /home/kshitiz/class/external/HyRec2020/Alpha_inf.dat
in allocate_and_read_fit: could not open file /home/kshitiz/class/external/HyRec2020/fit_swift.dat

10 1e+30 2.270224e+00 1.116459e-01 9.631547e-01 2.394928e+00 7.063477e-01 8.449914e-02 0.000000e+00 0.000000e+00

@Kshitizpandey123
Copy link
Author

Here is the full message, if this helps:
Error in Class: thermodynamics_init(L:372) :error in thermodynamics_workspace_init(ppr,pba,pth,ptw);
=>thermodynamics_workspace_init(L:857) :error in thermodynamics_hyrec_init(ppr,pba,pth,ptw->SIunit_nH0,pba->T_cmb,ptw->fHe, ptw->ptdw->ap_z_limits[ptw->ptdw->index_ap_brec],ptw->ptdw->phyrec);
=>thermodynamics_hyrec_init(L:46) :error in hyrec_allocate;
=>
**** ERROR HAS OCCURRED in HYREC-2 ****
in allocate_and_read_atomic: could not open file /home/kshitiz/class/external/HyRec2020/Alpha_inf.dat
in allocate_and_read_fit: could not open file /home/kshitiz/class/external/HyRec2020/fit_swift.dat

@brinckmann
Copy link
Owner

Something seems to be going wrong with your paths, you will notice the former paths point to
path['cosmo'] = '/home/kshitiz/class_public-3.2.3'
while the errors point to
/home/kshitiz/class/
I can't be sure how this is happening, but this appears to be your problem. Are you making sure to create a new chains directory after making changes to your default.conf or your input param file? Otherwise the code will use your old settings if you're rerunning in the same chains directory. This is my best guess for what is going wrong.

Best,
Thejs

@Kshitizpandey123
Copy link
Author

My CLASS main folder's name was "class_public-3.2.3", but it looks like there is some default / hard-coded path within the code itslef that only recognizes "class" as the main folder's name. I changed the name of my folder to "class" and it works now!
Thank you so much, wouldn't have been possible to identify this without your intervention!

@brinckmann
Copy link
Owner

Glad you got it to work! MontePython doesn't hard code the path, but if you have more than one compiled version of class it might be taking the path of your most recently compiled class version, so another option might have been to recompile the version of class you wanted to use. On some systems it's a problem where it doesn't take the version from default.conf and instead takes the most recently compiled class version. I find it likely this was one of those issues.
Best,
Thejs

@brinckmann brinckmann added the bug Something isn't working label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants