baudren / montepython_public

Public repository for the Monte Python Code
MIT License
65 stars 115 forks source link

Problem in using sdss likelihood #91

Closed pchaubal closed 7 years ago

pchaubal commented 7 years ago

We have been trying to use sdss likelihood but it showed the following error: `Traceback (most recent call last): File "montepython/MontePython.py", line 40, in sys.exit(run()) File "/home/prakrut/class/montepython_public-2.2/montepython/run.py", line 44, in run sampler.run(cosmo, data, command_line) File "/home/prakrut/class/montepython_public-2.2/montepython/sampler.py", line 43, in run mcmc.chain(cosmo, data, command_line) File "/home/prakrut/class/montepython_public-2.2/montepython/mcmc.py", line 432, in chain newloglike = sampler.compute_lkl(cosmo, data) File "/home/prakrut/class/montepython_public-2.2/montepython/sampler.py", line 515, in compute_lkl value = likelihood.loglkl(cosmo, data) File "/home/prakrut/class/montepython_public-2.2/montepython/likelihood_class.py", line 1725, in loglkl P_lin[i] = cosmo.pk(self.k[i], self.redshift) File "classy.pyx", line 714, in classy.Class.pk (classy.c:10811) classy.CosmoSevereError:

Error in Class: spectra_pk_at_k_and_z(L:568) :condition ((k < 0.) || (k > exp(psp->ln_k[psp->ln_k_size-1]))) is true; k=7.714346e-01 out of bounds [0.000000e+00:7.520407e-01] ` We couldn't understand how to resolve it. Any help would be appreciated. Thanks.

brinckmann commented 7 years ago

You need to increase how far CLASS will compute the Pk, by increasing P_k_max_h/Mpc or P_k_max_1/Mpc.

pchaubal commented 7 years ago

I did as suggested but the problem still persists. I think the problem is somewhere in the sdss/wiggleZ likelihood code of montepython in the scaling of k

borisbolliet commented 7 years ago

Hi, I had the same issue. Solved by NOT specifying P_kmaxh/mpc.

It is set automatically by the likelihood class mpk.

There is no problem in the SDSS/WiggleZ lkl.

Best, Boris

brinckmann commented 7 years ago

Hi, Sorry, my solution was not so clear. You have the following line in the likelihood:

    self.need_cosmo_arguments(
        data, {'P_k_max_h/Mpc': khmax, 'z_max_pk': self.redshift})

Simply increase the number, e.g. set 2.0 x khmax. The value is not that important, it should just be large enough that the entirety of your window functions are included. In the end your data only goes to 0.2 h/Mpc.

The problem is your kbands file goes to k = 1 h/Mpc, but CLASS is only being asked to calculate the power spectrum to 0.75 h/Mpc. I'm not sure why this happened, perhaps my solution for loading the kbands file was incorrect? You can check if the loaded kbands array goes from 1e-4 to 1 h/Mpc, as it should.

Regards, Thejs

pchaubal commented 7 years ago

Hi, Thanks a lot Thejs and Boris. I was confused about the previous solution. The previous comment made it clear. The program is running fine. The kbands arrays are loading properly and go upto 1 h/Mpc. So I think there is no problem in montepython.