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

nCl with the wrapper? #12

Closed aurelienbl closed 10 years ago

aurelienbl commented 10 years ago

Hello,

Is it possible to get the galaxy-related Cls (option nCl or dCl) from the Python wrapper? I have looked a bit at the code, and it seems that raw_cl is only limited to CMB + lensing potential power spectra. Is that correct?

If so, is there any plan to include the LSS observable within the wrapper ?

Thanks a lot for this wonderful tool!

Cheers, Aurélien

baudren commented 10 years ago

Hello @aurelienbl

yes, their implementation is on the way - I was on holiday last week, which paused the process. It is actually more work than I expected, for I took the opportunity to clean up the code in these two functions, raw_cl and lensed_cl, in order to output only the requested spectra.

So, next release will have them, sorry for the wait!

aurelienbl commented 10 years ago

Great! Thanks a lot!

bfollinprm commented 10 years ago

Is the status of the perturbation outputs generated by the "k_output_values" parameter the same?

ThomasTram commented 10 years ago

Hi, what do you mean by the status of the perturbation outputs? Is there an issue?

baudren commented 10 years ago

@aurelienbl Just to chime in, the implementation of density_cl is now completed, and will be released with the next version!

bfollinprm commented 10 years ago

Sorry, was on vacation. Asserting the k_output_values keyword in classy (to directly output the overdensities as a function of wavenumber and conformal time of each individual species) results in class attempting to open a file for writing, rather than piping the output to a slave variable of the classy instance. Here's the error:

Error in Class: perturb_init(L:347) :error in perturb_solve(ppr, pba, pth, ppt, index_md, index_ic, index_k, pppw[thread]); =>perturb_solve(L:2207) :error in perturb_prepare_output_file(pba,ppt,ppw,index_ikout,index_md); =>perturb_prepare_output_file(L:2334) :could not open ppw->perturb_output_file with name output/perturbations_k1_s.dat and mode "w"

Succinctly, classy is trying to create a file in the class directory entitled 'output/perturbations_k1_s.dat', instead of the more natural (and useful) behavior of storing the data in a dictionary--if we have a Class instance entitled cosmo, one would expect classy to create cosmo.perturbations_k1_s, or something.

I was just wondering if there were plans to fix this in the works, or if I should take a look at it myself.

azamctp commented 10 years ago

Hi I am new to cosmology and this class code.Can anyone help me to understand this code ?

thanks

aurelienbl commented 10 years ago

Great! Thanks a lot!

On 06/08/2014 10:19, baudren wrote:

@aurelienbl https://github.com/aurelienbl Just to chime in, the implementation of |density_cl| is now completed, and will be released with the next version!

— Reply to this email directly or view it on GitHub https://github.com/lesgourg/class_public/issues/12#issuecomment-51306105.

lesgourg commented 10 years ago

@bfollinprm : Thanks for your questions. In principle, for each new discussion, one should open a new issue on github; we are here in the issue "nCl with the wrapper?", your point is a different one; I am happy to answer, but please open a new issue next time, we are about to close this one anyway.

So, Class is initially a C code and all its functionalities are accessible through input files (like in the example explanatory.ini). One of these functionalities is to plot the evolution of perturbations with time, emulated by the input field k_output_values, and then results are written in a file. If you prefer to use Class as a python module, you can indeed use classy, but this python interface is not yet an exhaustive wrapper of all Class functions! So far, it is designed mainly for the purpose of the parameter extraction code Monte Python, and hence for computing and storing the power spectra (CMB and large scale structure). I hope that sooner or later, we will have time to encapsulate all Class functions inside classy. At this point, as you say, when k_output_values are passed, the result should go in slave variable of the classy instance. Same with "write background", "write thermodynamics", etc: none of these can yet be handled by classy, so one has to use them directly with the C code, called with some input files. Just one more remark: we cannot reproduce your error, we just see that if we pass k_output_values to classy, nothing happens (but there is no error).

lesgourg commented 10 years ago

@azamctp : please open a new issue for your questions, if they are not related to previous one. I will answer you anyway and then close this issue, you can open a new one in the future. So, the main web page of CLASS is http://http://class-code.net, where you will find some basic explanations and references. I recommend in particular reading the CLASS I paper arXiv:1104.2932. For more details you might wish to go through the lecture notes at http://lesgourg.web.cern.ch/lesgourg/class-tour/class-tour.html

We always assumed that people visit the github page after seeing http://http://class-code.net, but this is not necessarily true, so in the future we should add a link from the github page to the explanatory page, hoping that it will be helpful for people like you. Best, -Julien