GithubHelp home page GithubHelp logo

lesgourg / class_public Goto Github PK

View Code? Open in Web Editor NEW
220.0 220.0 292.0 738.34 MB

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)

Python 5.39% C++ 1.25% Makefile 0.27% C 85.04% MATLAB 0.19% Jupyter Notebook 3.33% Cython 4.52%

class_public's People

Contributors

baudren avatar benabed avatar bohr-s avatar cyrilpitrou avatar dchooper avatar jesustorrado avatar lesgourg avatar marchidiacono avatar marius311 avatar ohahn avatar samuelbrieden avatar sbird avatar schoeneberg avatar thomastram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

class_public's Issues

CLASS segfaults when tensor modes and k_output_values are both present in .ini file

Here is a init file which crashes CLASS:

output = tCl, pCl,lCl,mPk
output_verbose = 1
non linear = halofit
z_pk = 0.0,1.0,2.0
write background = yes
write warnings = yes
write primordial = yes
k_output_values = 0.001,0.01
modes=s,t

When run with gdb, I receive:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004a3c05 in output_perturbations (pba=pba@entry=0x7fffffff2720,
ppt=ppt@entry=0x7fffffff6480, pop=pop@entry=0x7fffffff4800) at ../source/output.c:1294
1294 k = ppt->k[index_md][ppt->index_k_output_values[index_ikout]];

Problem with sigma_8

I am experiencing a problem when the code computes sigma_8 in certain models:

Error in spectra_init
=>spectra_init(L:1268) :error in spectra_pk(pba,ppt,ppm,pnl,psp);
=>spectra_pk(L:2711) :error in spectra_sigma(pba,ppm,psp,8./pba->h,0.,&(psp->sigma8));
=>spectra_sigma(L:2801) :error in spectra_pk_at_k_and_z(pba,ppm,psp,k,z,&pk,pk_ic);
=>spectra_pk_at_k_and_z(L:568) :condition ((k < 0.) || (k > exp(psp->ln_k[psp->ln_k_size-1]))) is true; k=5.505146e+00 out of bounds [0.000000e+00:5.505146e+00]

(the parameters.ini file is copied at the end) There is no problem for other models, e.g. when fixing omega_cdm = 0.110616 there is no problem.

I've tried to substitute (i=0;iln_k_size;i++) -> (i=0;iln_k_size -1 ;i++) in the loop for the integration of sigma (in spectra.c). That fixes the error, but gives a very bad value of sigma_8:

-> sigma8=1.48732 (computed till k = 7.86449 h/Mpc)

Here is the input file:

List of input/precision parameters actually read
(all other parameters set to default values)
Obtained with CLASS v2.1.2 (for developpers: svn version 6142M)
This file can be used as the input file of another run
h = 0.7
N_ur = 3.046
N_ncdm = 0
Omega_k = 0.
Omega_fld = 0.
YHe = BBN
recombination = RECFAST
reio_parametrization = reio_camb
z_reio = 10.
output = mPk,mTk
non linear = halofit
modes = s
ic = ad
gauge = synchronous
P_k_ini type = analytic_Pk
k_pivot = 0.002
A_s = 2.3e-9
n_s = 1.
alpha_s = 0.
P_k_max_h/Mpc = 1.
z_pk = 0., 1., 3.5
root = output/planck_
headers = yes
format = class
write background = yup
write thermodynamics = no
write parameters = yeap
background_verbose = 1
thermodynamics_verbose = 1
perturbations_verbose = 1
transfer_verbose = 1
primordial_verbose = 1
spectra_verbose = 1
nonlinear_verbose = 1
lensing_verbose = 1
output_verbose = 1

Adding non-smooth background functions

Hi!

I am trying to work with a background function which I want to set to a particular value after it reaches this value dynamically. For instance, if my function is f=X, I want to assign

if(X<=0) {f=0;}
else{f=X;}

However, this does not seem to be possible in general. Notice that this will make the function continuous, but not smooth. The code often says

Error in perturb_init
=>perturb_init(L:363) :error in perturb_solve(ppr, pba, pth, ppt, index_md, index_ic, index_k, pppw[thread]);
=>perturb_solve(L:2382) :error in generic_evolver(perturb_derivs, interval_limit[index_interval], interval_limit[index_interval+1], ppw->pv->y, ppw->pv->used_in_sources, ppw->pv->pt_size, &ppaw, ppr->tol_perturb_integration, ppr->smallest_allowed_variation, perturb_timescale, ppr->perturb_integration_stepsize, ppt->tau_sampling, tau_actual_size, perturb_sources, perhaps_print_variables, ppt->error_message);
=>evolver_ndf15(L:474) :error in new_linearisation(&jac,hinvGak,neq,error_message);
=>new_linearisation(L:967) :condition (funcreturn == FAILURE) is true; Failure in sp_ludcmp. Possibly singular matrix!

Even if this function is not used in the perturbation module, one gets the previous complaint. If the discontinuity in the derivative is not big, the error goes away.

I was thinking about smoothing the transition by a regularized Heaviside function, but before I was wondering if there is another way to do it.

Thanks a lot!

Diego

Models with class_test and memory leaks

I'm experiencing problems with memory leaks for models in which a class_test is triggered during the execution (this is in a modified version of class). After talking to Julien I used class_test_except to make sure I correctly freed the intermediate structures, but the problem persists.

Finally, I tracked the problem down to the classy wrapper, which fails to free the corresponding structure (e.g. call 'background_free'). This happens because in the function 'compute' each module is called in the following way:

if "background" in level:
if background_init(&(self.pr), &(self.ba)) == FAILURE:
self.struct_cleanup()
raise CosmoComputationError(self.ba.error_message)
self.ncp.add("background")

but in struct_cleanup, the procedure is

if self.ready == FALSE:
return
(...)
if "background" in self.ncp:
background_free(&self.ba)

When an error occurs (e.g. in background_init), struct_cleanup does not free the relevant structures for two reasons: 1) self.ready is FALSE, so the function terminates and 2) self.ncp does not contain "background" because this is added only if background_init is successful.

I've sort of made my way around it by correcting both problems whenever an structure_init returns FAILURE. This was simply by adding

self.ncp.add("background")
self.ready = TRUE

before self.struct_cleanup() in 'compute', and similarly for other structures (thermodynamics, perturb, etc...). This seems to fix a lot of the problems that I was having when using my modified code in MontePython.

I'm submitting this as an issue rather than a pull request because 1) I think other people don't have this problem and 2) this is my first contact with classy and I might be easily doing something wrong.

cross correlation power spectrum with python wrapper is not available

The cross correlation power spectrum of density-lensing is available if we run class from command line while we do not have it when we do this using python wrapper.
The python script seems like this

from classy import Class
cosmo = Class()
cosmo.set({'output': 'tCl, nCl, sCl'})
cosmo.compute()

cosmo.density_cl()
cosmo.raw_cl()

density_cl.viewkeys()
raw_cl.viewkeys()

and what I got is

dict_keys(['dd', 'll', 'ell'])
dict_keys(['tt', 'ell'])

which does not include the 'dl' cross correlation. If we turn on 'lensing': 'yes', we also expect to have phi-lensing cross correlation but we do not have it with python wrapper.

Primordial spectra in open universe-- Inflationary Module

Hi,
I am new using CLASS.
I want to calculate the primordial spectrum for a scalar field potential, which will fall in the category of large field model, in open universe.

  1. I do not think that by taking care of universe curvature (open,closed or flat) in explanatory file, it is also ensured that inflationary module also calculates spectra in a curved universe. If I am mistaken, please clarify.
  2. I am getting error that slope of your potential is positive (which of course is!) and code can not handle this kind of potential.

How can I tackle both the issues?

With best regards,
Rakesh

classy issue on linux mint15?

class compiles fine, and the setup.py script for classy runs without error (other than the usual _import_array and _import_umath defined-but-unused warnings). However, when i attempt

import classy

i get

/anaconda-1.7.0/lib/python2.7/site-packages/classy.so: undefined symbol: __pow_finite

I'm pretty sure that __pow_finite is a reference to the pow() function in libm, so I tried a direct linking to the c math library, to no avail. Thoughts?

How to use Class for new dark energy equation of state A/A+(1-A)a^-3(1+@)?

Hi
I want to use class for a new dark energy equation what modifications should i make to class?
I tried modifying the code by using new equation in background.c instead of w=w0+wa(1-a/ao)
The exact changes that i made are..
/* using equation of state w=A/A+(1-A)a^-3(1+@) A=w0 and @=wa/
if (pba->has_fld == TRUE) {
pvecback[pba->index_bg_rho_fld] = pba->Omega0_fld * pow(pba->H0,2)
*1/pow((pba->w0_fld+((1-pba->w0_fld)
(pow(a_rel,3_(1+pba->wa_fld))))),(double)(1/(1+pba->wa_fld)));
rho_tot += pvecback[pba->index_bg_rho_fld];
p_tot += ((pba->w0_fld)/(pba->w0_fld+(1-pba->w0_fld)_(pow(a_rel,3*(1+pba->wa_fld))))) * pvecback[pba->index_bg_rho_fld];
}

but when i run it using lcdm.ini file i got following error msg
Error running background_init
=>background_init(L:593) :error in background_solve(ppr,pba);
=>background_solve(L:1499) :error in generic_integrator(background_derivs, tau_start, tau_end, pvecback_integration, &bpaw, ppr->tol_background_integration, ppr->smallest_allowed_variation, &gi);
=>generic_integrator(L:112) :error in rkqs(&x, h, eps, &hdid, &hnext, derivs, parameters_and_workspace_for_derivs, pgi);
=>rkqs(L:156) :condition (xnew == *x) is true; stepsize underflow at x=nan

I know that i should make some modifications in perturbations.c but i cant understand how?
Please help!

Thanks
Azam

Undefined reference to 'isinfinite'

When I try to compile class, it throws the error 'undefined reference to 'isinfinite'

Here's the full error:
build/background.o: In function background_initial_conditions': ...3/build/../source/background.c:1815: undefined reference toisfinite'

How can I resolve this?

Thanks!

Output scale of CMB spectra in python example

Hiya.

When I run through the python example on your wiki and take, for example, the peak value of ell (ell+1) C^TT_ell / 2pi is about 7.8e-10.

It's not clear from the docs what the output scale or units of the C_ell output are, or how we can change it to physical units. Can you advise?

Thanks,
Joe Zuntz

Meaning of Cls in python wrapper?

Hey

Quick question:
What are the Cls that are in the dictionary in the python wrapper?

In particular, when lensing is on and adiabatic plus isocurvature modes are being run.
Are they the sum of the different modes plus lensing?
Can I access different Cls through this dictionary, i.e. just isocurvature, lensed or unlensed, etc. If so, is there a list of commands somewhere as to the different possibilities?

I have been looking for the answer in the documentation and couldn't find it; my apologies if I've missed it.

Thanks
Dan

Perturbation output with wrapper

Feature request following the suggestion from @bfollinprm: When k_output_values is passed to CLASS, it will produce an output file with values of available perturbations. It would be nice to have the same information available in the wrapper.

Initial thoughts: This is not so straightforward, since the perturbation output is handled 'on-the-fly' while integrating perturbations by the function print_variables(). The first task is then to ask print_variables to store the perturbation output. This would also allow the writing of perturbation files to be moved to the output module which is more natural.

Storing the raw output from the perturbation computation, even for a limited number of k-values, is not desirable, since it would take up a large bit of memory, and it would not be easily accessible since the number of perturbation variables change with approximation scheme. So it is better to let pre-select the variables which are stored.

We use two macros for writing the files, class_fprintf_columntitle() for writing titles and class_fprintf_double() for writing values. These macros automatically checks if the species is available at all. By writing two similar macros, class_store_columntitle() and class_store_double() which store the titles and the output in memory, we would not need to change much and we would allow the wrapper to extract both names and values for use in a dictionary.

CMB lensing potential in redshift bin

Hi everybody,

I would like to evaluate the CMB lensing potential C_l^{phiphi} sourced in a given redshift bin (z_min, z_max), and possibly its cross-correlation with some LSS tracer, say C_l^{phi g}.
Is there a quick hack to do so?

Thanks for the help and for providing such nice code!

federico

Weird Cl for galaxy density at different redshift bins

Hello,
When generating galaxy number density with 'nCl' in more than one redshift bin, the cross term between bins shows a weird result (a sharp peak) for a few low ells -- see plot below. The position of the peak depends of the redshift bins used. For neighbouring bins, the peak moves to higher ell as the redshift increases. The use of a tophat selection function sharpens the peak while a gaussian smoothes it out. The input used to reproduce this result is the one below:

output = nCl
l_max_lss = 50
selection = tophat
selection_mean = 0.4, 0.5
selection_width = 0.05
non_diagonal = 1
root = ./output/test_
headers = yes
format = class
write parameters = yeap

class_dens1-dens2_output

Compiling python wrapper with Intel C Compiler (icc)

When trying to compile the python wrapper, python/setup.py invokes the wrong compiler (gcc) even though the compiler which is set up in the Makefile is icc. I have bypassed this issue by running manually the compilation commands shown on the screen by replacing any occurrence of 'gcc' with 'icc'.
For OpenMP pararellization, I also needed to include -lpthread flag in OMPFLAG in the Makefile (together with -openmp). I think that's a requirement for Intel Math Kernel Library users.

Support for Python 2.6 or earlier for the python interface

I noticed a problem building Class with Python 2.6.8 (where the documentation of Monte Python shows it should also work): The check_output method is not present for python 2.6 or earlier.

python setup.py build

Traceback (most recent call last):
File "setup.py", line 10, in
gccpath = osp.normpath(osp.dirname(sbp.check_output("gcc -print-libgcc-file-name",shell=True)))
AttributeError: 'module' object has no attribute 'check_output'

Here is the fix: in setup.py

gccpath_string = sbp.Popen(['gcc', '-print-libgcc-file-name'], stdout=sbp.PIPE).communicate()[0]
gccpath = osp.normpath(osp.dirname(gccpath_string))

Would you prefer me to send a pull request, or you may prefer to fix it yourself, or leave it as it is?

Thanks!
Yi

wrapper improvements

It would be nice to have a function setting all verbose flags to 1 through the wrapper.

Also, it would be nice to be able to read from a .ini file, and write the current parameters used to a .ini file.

nCl with the wrapper?

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

Matter power spectrum for small scales

I’m having a problem running class to get the matter power spectrum for very small scales. I’m running the latest version 2.4.2. I just changed the explanatory.ini file to include the matter power spectrum in the output (line 292) and the k_max value for matter power spectrum (line 598). Currently using P_k_max_h/Mpc = 1e3 but I’ll need to go to even smaller scales. Running class I get the following error:

Running CLASS version v2.4.2
Computing background
-> age = 13.795359 Gyr
-> conformal age = 14165.045412 Mpc
Computing thermodynamics with Y_He=0.2477
-> recombination at z = 1089.267451
corresponding to conformal time = 280.576042 Mpc
with comoving sound horizon = 144.695940 Mpc
angular diameter distance = 12.734921 Mpc
and sound horizon angle 100*theta_s = 1.042142
-> baryon drag stops at z = 1059.171266
corresponding to conformal time = 286.488461 Mpc
with comoving sound horizon rs = 147.376600 Mpc
-> reionization with optical depth = 0.092473
corresponding to conformal time = 4255.316282 Mpc
Computing sources

Error in perturb_init
=>perturb_init(L:363) :error in perturb_solve(ppr, pba, pth, ppt, index_md, index_ic, index_k, pppw[thread]);
=>perturb_solve(L:2372) :error in generic_evolver(perturb_derivs, interval_limit[index_interval], interval_limit[index_interval+1], ppw->pv->y, ppw->pv->used_in_sources, ppw->pv->pt_size, &ppaw, ppr->tol_perturb_integration, ppr->smallest_allowed_variation, perturb_timescale, ppr->perturb_integration_stepsize, ppt->tau_sampling, tau_actual_size, perturb_sources, perhaps_print_variables, ppt->error_message);
=>evolver_ndf15(L:461) :condition (absh <= hmin) is true; Step size too small: step:2.22045e-16, minimum:2.22045e-16, in interval: [1.14856:364.763]

Improve and document the function perturb_print_variables

The current existing function, perturb_print_variables, allows one to plot the time evolution of quantities for some selected wave-numbers. It right now requires a modification of the source code, and some amount of guess work to find the right spot.

A cleaner and more flexible implementation would be welcome.

dNdz for matter power spectrum

I have a total data sample of dNdz, shaping almost gaussian. I would like to get matter power spectrum of this sample. I have binned the sample with some redshift width and also am trying to get power spectrum of each bin. Those subsamples have some weird shape because they are not gaussian any more. I am not sure how accurately the class code work for narrow bin. I have applied the total dNdz_selection = "file" which contains the total distribution and applied top hat for each bin to be considered for calculation. I would like to make sure whether I am using the ideal function for putting in number distribution. Please let me know.

Compilation issues for classy with Mac OS X 10.9 Mavericks

With the latest Mac OS, the default C compiler does not support openMP, and by default compiles with both 64 and 32 architectures. The resulting libclass.a is then not recognised by the setup.py script that installs the Python wrapper for CLASS. Two possible solutions

  1. The clean way: get a proper C compiler and Python version from Homebrew, macports, what have you. Be sure to use those both for compiling CLASS and classy. If some people that tried that could report here, that would be great.

  2. The dirty way around:

  • compile CLASS with cc, without openMP
  • run python setup.py build. This should run and throw a warning. Simply copy the compile line, remove the offending flags (at least -arch i386, maybe more?) and execute that.
  • the again, python setup.py install --user, though this line is not necessary as usual.

Class gets stuck (and doesn't produce any outputs after "Computing sources")

I have just cloned the most recent "class_public" with "git clone https://github.com/lesgourg/class_public.git class" and compiled it with either "make" or "make -j" (for montepython). Running "./class explanatory.ini" then as a sanity check seems to get stuck in/after the step "Computing sources" (i.e. no further output for >hours; check with"top/htop" shows that class is still running on all available cores...). However, pulling the branch "2.4" and compiling it the same way yields a proper class run with output-files within a second.

Polarization and shear in the index_tp_t0 term

Dear Julien,

I am trying to understand the set_source(ppt->index_tp_t0), set_source(ppt->index_tp_t1), set_source(ppt->index_tp_t2) terms in perturbation.c.. They seem to correspond to Eq. 8.52 in Dodelson's "Modern Cosmology", after integration by parts in 8.51. But I struggle to understand why there is no g*P (the combination of polarization and photon shear) in set_source(ppt->index_tp_t0)?

It would be great if you can help me understand the structure of set_source(ppt->index_tp_t0), set_source(ppt->index_tp_t1), set_source(ppt->index_tp_t2).

Thanks a lot!
Michael

OMP not thread safe

Dear Julien et al;

We have been using CLASS with some nested sampling and have noticed what appears to be a memory leak. When checking through the test files for each of the CLASS modules, it first appears when perturbations are added.

Calling test_perturbations with Valgrind gives:
[mmcleod@splinter class_v2.4.1]$ valgrind --leak-check=yes ./test_perturbations explanatory.ini
==19551== Memcheck, a memory error detector
==19551== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19551== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==19551== Command: ./test_perturbations explanatory.ini
==19551==
Running CLASS version v2.4.1
Computing background
-> age = 13.795359 Gyr
-> conformal age = 14165.045412 Mpc
Computing thermodynamics with Y_He=0.2477
-> recombination at z = 1089.267451
corresponding to conformal time = 280.576042 Mpc
with comoving sound horizon = 144.695940 Mpc
angular diameter distance = 12.734921 Mpc
and sound horizon angle 100*theta_s = 1.042142
-> baryon drag stops at z = 1059.171266
corresponding to conformal time = 286.488461 Mpc
with comoving sound horizon rs = 147.376600 Mpc
-> reionization with optical depth = 0.092473
corresponding to conformal time = 4255.316282 Mpc
Computing sources
==19551==
==19551== HEAP SUMMARY:
==19551== in use at exit: 7,784 bytes in 18 blocks
==19551== total heap usage: 109,562 allocs, 109,544 frees, 155,510,500 bytes allocated
==19551==
==19551== 288 bytes in 1 blocks are definitely lost in loss record 3 of 5
==19551== at 0x4A08844: calloc (vg_replace_malloc.c:623)
==19551== by 0x3014610002: _dl_allocate_tls (in /lib64/ld-2.5.so)
==19551== by 0x3015606EB8: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
==19551== by 0x4C3A8C5: gomp_team_start (team.c:439)
==19551== by 0x45A94F: perturb_init (perturbations.c:264)
==19551== by 0x4903F4: main (test_perturbations.c:45)
==19551==
==19551== 4,032 bytes in 14 blocks are possibly lost in loss record 5 of 5
==19551== at 0x4A08844: calloc (vg_replace_malloc.c:623)
==19551== by 0x3014610002: _dl_allocate_tls (in /lib64/ld-2.5.so)
==19551== by 0x3015606EB8: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
==19551== by 0x4C3A8C5: gomp_team_start (team.c:439)
==19551== by 0x45A94F: perturb_init (perturbations.c:264)
==19551== by 0x4903F4: main (test_perturbations.c:45)
==19551==
==19551== LEAK SUMMARY:
==19551== definitely lost: 288 bytes in 1 blocks
==19551== indirectly lost: 0 bytes in 0 blocks
==19551== possibly lost: 4,032 bytes in 14 blocks
==19551== still reachable: 3,464 bytes in 3 blocks
==19551== suppressed: 0 bytes in 0 blocks
==19551== Reachable blocks (those to which a pointer was found) are not shown.
==19551== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==19551==
==19551== For counts of detected and suppressed errors, rerun with: -v
==19551== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 7 from 7)

This however is apparently rectified if we turn off OMP:
[mmcleod@splinter class_v2.4.1]$ valgrind --leak-check=yes ./test_perturbations explanatory.ini
==19338== Memcheck, a memory error detector
==19338== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19338== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==19338== Command: ./test_perturbations explanatory.ini
==19338==
Running CLASS version v2.4.1
Computing background
-> age = 13.795359 Gyr
-> conformal age = 14165.045412 Mpc
Computing thermodynamics with Y_He=0.2477
-> recombination at z = 1089.267451
corresponding to conformal time = 280.576042 Mpc
with comoving sound horizon = 144.695940 Mpc
angular diameter distance = 12.734921 Mpc
and sound horizon angle 100*theta_s = 1.042142
-> baryon drag stops at z = 1059.171266
corresponding to conformal time = 286.488461 Mpc
with comoving sound horizon rs = 147.376600 Mpc
-> reionization with optical depth = 0.092473
corresponding to conformal time = 4255.316282 Mpc
Computing sources
==19338==
==19338== HEAP SUMMARY:
==19338== in use at exit: 0 bytes in 0 blocks
==19338== total heap usage: 109,451 allocs, 109,451 frees, 155,483,288 bytes allocated
==19338==
==19338== All heap blocks were freed -- no leaks are possible
==19338==
==19338== For counts of detected and suppressed errors, rerun with: -v
==19338== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 7)

This suppresses the memory leak but naturally makes things run much more slowly!

Temperature-galaxy cross-correlation

Hello,

I would like to implement the usual temperature-galaxy cross-correlation.
This should be an easy modification, which follows what already done for the lensing-galaxy XC.

Can someone point me to the proper part of code, where I can specify the window function for the
temperature (i.e. late-ISW)?

Is there any plan to implement this XC?

Thanks!
Simone

Increasing sampling of mPk

Hi,

I would like to increase the number of values of k at which CLASS outputs mPk, dTk, and vTK. Which part do I need to modify to be able to do that?

Thanks,

Arka

Output both unlensed C_ell and normalized C_ell, ell(ell+1)/2pi*C_ell

Hi,

My colleagues and I are slightly confused:

The correct command to get the temperature Cl's is cls =
cls = cosmo.raw_cl()['tt']
and other Cl's are available by substituting 'tt' bt 'te', 'ee', or 'bb'. If you want a different l_max than the default, you should also pass the parameters l_max_scalars and l_max_tensors.

The output cls = cosmo.raw_cl()['tt']: is this C_ell or the normalized C_ell, ell(ell+1)/2pi*C_ell?

Is there a way to output both unlensed C_ell and the normalized C_ell, D_ell = ell(ell+1)/2pi*C_ell?

Thanks!

Computing two-point angular correlation function

I am struggling to use CLASS to directly compute and plot the two-point temperature correlation function C(theta). (See for example first-year WMAP release, astro-ph/0302207v3.pdf, equations (5) and (6) in Section 7. Full derivation found in Durrer 2008 textbook "The Cosmic Microwave Background", equation 2.240.) The measured quantity was released as a WMAP first-year data product. I would like to plot the theoretical prediction C(theta) versus theta.

Naturally, I can manipulate the CLASS-generated outputs C_l and ell in order to calculate this expression. I could then convert ell values into theta, and plot the results. However, I would ideally like to directly compute C(theta) using Boltzmann codes. Is there a method to do this with CLASS? Thanks for the help, and thank you for maintaining this excellent code!

Python interface broken with Intel icc

When I compiled class with intel icc (version 14.0.0, with -O3 flag) and use it with python, I get the below error. Using gcc does not have this problem.

Python 2.6.9 (unknown, Jul 28 2014, 08:24:16) 
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import classy
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: /home/cosmos/users/dc-wang2/.local/lib/python2.6/site-packages/classy.so: undefined symbol: __intel_sse2_strcpy
>>>

segmentation fault (core dumped)

This might appear to be a trivial issue, but I am unable to find the solution because of deficient programming skills.
The unmodified explanatory.ini file works fine, but when I modified explanatory.ini by changing write Background = yes , and then execute , I get segmentation fault (core dumped). The detailed description is given below:

mandar@mandar-VirtualBox:~/class_public-2.4.2$ ./class my_input.ini
Running CLASS version v2.4.2
Computing background
-> age = 13.795359 Gyr
-> conformal age = 14165.045412 Mpc
Computing thermodynamics with Y_He=0.2477
-> recombination at z = 1089.267451
corresponding to conformal time = 280.576042 Mpc
with comoving sound horizon = 144.695940 Mpc
angular diameter distance = 12.734921 Mpc
and sound horizon angle 100*theta_s = 1.042142
-> baryon drag stops at z = 1059.171266
corresponding to conformal time = 286.488461 Mpc
with comoving sound horizon rs = 147.376600 Mpc
-> reionization with optical depth = 0.092473
corresponding to conformal time = 4255.316282 Mpc
Computing sources
Computing primordial spectra (analytic spectrum)
No non-linear spectra requested. Nonlinear module skipped.
Computing transfers
Computing unlensed linear spectra
Computing lensed spectra (fast mode)
Writing output files in output/toto_...
Segmentation fault (core dumped)

When I analyse the core file by GDB, this appears:

mandar@mandar-VirtualBox:~/class_public-2.4.2$ gdb file core
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
http://bugs.launchpad.net/gdb-linaro/...
Reading symbols from /usr/bin/file...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 5653]
Core was generated by `./class my_input.ini'.
Program terminated with signal 11, Segmentation fault.
#0 0x0808e954 in ?? ()

Maximum number of output files for Pk

Hi,
when trying to output the power spectra for 16 different redshifts, I got the error message:

input_init(L:1314) :condition (int1 > _Z_PK_NUM_MAX_) is true; you want to write
some output for 16 different values of z, hence you should increase
_Z_PK_NUM_MAX_ in include/output.h to at least this number

The error message is quite helpful, and I changed the definition of _Z_PK_NUM_MAX_ , in output.h from 10 to 20 and after compiling, it worked.

Is there a good reason, why the number of output files has to be a preprocessor definition and cannot be a parameter in the parameter file? This would avoid having to recompile and so on.

Cheers,

Santiago

Dark Energy models

Hello,

I'm running CLASS v2.0.4 to compute temperature power spectra, using the cosmological models defined in the Planck's chains.
For some reason, it get stuck on "Computing sources" with some cosmological models, one of which is here specified:
A_s = 2.1431e-9
n_s = 0.953
H_0 = 80.02
\omega_b = 0.0220
\omega_c = 0.1224
\Omega_k = 0
Y_p = 0.2477
\tau = 0.07481
\w0 = -1.61615
\wa = 0.662

I never had problems with flat \Lambda CDM and flat \w0CDM models.
I did not tried with other versions of CLASS.

Thanks,
Simone

Compute time derivatives of background functions

Hi

I need to compute the time derivative of background quantities for the perturbation module. I can do it brute force by coding again the equations and storing the result but it would be great if CLASS would do it automatically. Adding a new interpolating function

int deriv_background_at_tau(

which produces a vector deriv_pvecback for all (or selected) quantities would be a good way to go.

Thanks

non-linear matter power specra of CLASS and CAMB

Hi all,
I have used CAMB so far and started using CLASS.
I compared matter power spectra generated by both codes.
The linear matter power spectra agree quite well but the problem is that non-linear matter power spectra are inconsistent with each other and the difference reaches about 10% at most.
Attached figures show the result, where I adopted WMAP 9 year cosmology and no massive neutrinos.
I have checked that both codes employ the same HaloFit of Takahashi et al. (2012).
The version of CLASS I used is 2.4.3 and CAMB is January 2015.
pk
pk_nl

Missing cross-correlations with non_diagonal=Nbins-1

I want to generate nCl and sCl in several redshift bins and all their cross-correlations, but CLASS does not output dens[i]-lens[j] cross-correlations for i>j. I tried this by setting selection_mean=x,y,z... and non_diagonal=Nbins-1.

E.g: For nCl, sCl and two redshift bins I should get 10 Cls but CLASS only generates 9 -- it does not generate the dens[2]-lens[1].

From the output layout I would guess the dens[i]-lens[j] follows the same output scheme as the dens[i]-dens[j] and lens[i]-lens[j]. For these last two it makes sense avoid i>j (because dens[i]-dens[j] = dens[j]-dens[i]), but this is not the case for dens[i]-lens[j].

Implementing modified gravity models

Hello everyone,
I would like to implement modified gravity models following the mu / gamma parametrisation also used e.g. in MGCAMB (http://arxiv.org/abs/1106.4543), where mu modifies the Poisson equation and gamma is the ratio between the psi and phi potentials (in absence of anisotropic stress).
The implementation of gamma seems straightforward, but I'm a bit lost in the perturbation module considering mu.. Did anyone try something similar before?

Thanks a lot!
Steffen

modifying class for fluid using parametrization equation W=Wo+Wa(1-a/a0)

Dear Julien et al,

I am new in using class.I want to calculate cl for different values of w using parametrization equation.
For this i modified class in the following manner .
In background_function instead of using
/* Lambda /
/
* if (pba->has_lambda == TRUE) {
pvecback[pba->index_bg_rho_lambda] = pba->Omega0_lambda * pow(pba->H0,2);
rho_tot += pvecback[pba->index_bg_rho_lambda];
p_tot -= pvecback[pba->index_bg_rho_lambda];
}**/

I am using
/* fluid with w=w0+wa(1-a/a0) and constant cs2 /
if (pba->has_fld == TRUE) {
pvecback[pba->index_bg_rho_fld] = pba->Omega0_fld * pow(pba->H0,2)
/ pow(a_rel,3.
(1.+pba->w0_fld+pba->wa_fld))
* exp(3.pba->wa_fld(a_rel-1.));
rho_tot += pvecback[pba->index_bg_rho_fld];
p_tot += (pba->w0_fld+pba->wa_fld*(1.-a_rel)) * pvecback[pba->index_bg_rho_fld];
}

But using this modifications when i am calculating cl for different w i am getting same cl for different values of w .Means i am doing some mistake
Please point out my mistakes.

Azam

sigma8 output

Hello,

Is it possible to make CLASS output the value of sigma8 given an .ini file?

Thanks,
Henrique

Changing V(phi) for inflation

Hello,

I am new using CLASS but I am really enjoying all I have used so far.
I have a question regarding the primordial power spectrum. I would like to change the potential for my inflation theory. I know that in the new CLASS version you have the option to have Taylor expanded potentials (inflation_V), but I would like to put a more complicated potential with 4 variables. Is this possible to do in CLASS? And then, is it possible to use Montepyhton to adjust those parameters?

What I was trying to do to input a different potential was to use an external_Pk, using the MultimodeCode (http://modecode.org/?page_id=13). However, I am trying to modify the output of multimode to be in the form that CLASS needs. It would be much easier if it was possible to modify CLASS directly.

Thank you very much for the help!!
Elisa Ferreira

using CLASS on Windows

Dear CLASS developer,

As uncommon as it is in the community, I am (not proudly) a Windows OS user.

I am trying to build your CLASS library with no success, since the makefile should be modified to fit Windows, and currently I don't know how to.

I have the Code::Blocks installed which includes a MINGW with a gcc compiler.
So I get errors when I "mingw32-make" in my cmd.

Please help, I don't know anyone else who works with Windows, and I have no option to switch.

Many thanks

changing expression of analytic primordial spectrum

Hi,

I am new to C and class and my questions are perhaps very basic, but I need an opinion all the same. I changed the expression of the primordial spectrum by another power law using a conditional statement. What I ask is to set to 0 the spectrum for a certain number of modes, then set it to the new expression I use for another range of k's and then to the usual standard cosmology power-law for the last range of observable modes. Then my if statements are used only to specify that if k is less than certain value, the spectrum is 0, if it is inside another range, the spectrum is the new expression and so on. I checked the output of the primordial spectrum and it looks fine, but the issue is that the output of the Cl's is a bunch of nan's in all columns. I would have thought that if the primordial spectrum was fine then there would be no problems, but then can I do something wrong in the way I write the conditional statements that affects the Cl's although P(k) is what is expected? Or maybe, I need to modify also another file apart from primordial.c in the source directory?

I would appreciate very much your advice on this please.

Thank you,

output: transfer function cdm density

Hi,

just a quick question I've failed to figure out. I want to know the cmd density transfer function T at z=1000. I define T as follows:

(delta rho/rho)_{z=1000} = T (delta rho/rho)_0

The output of CLASS is obviously not T, but might be something like const.(k^n * T (-1)^m) for some n,m. Can you tell me how I get T from the output of CLASS?

Thank you very much in advance.

B modes without lensing

I would like to find the BB spectrum from tensors (no lensing) using the python wrapper. I've written the following script which isolates the problem:

from classy import Class
import numpy as np

params = {
    'output': 'tCl pCl',
    'modes': 's,t'}

cosmo = Class()
cosmo.set(params)
cosmo.compute()
cls = cosmo.raw_cl(2000)
#cls = cosmo.lensed_cl(2000)
cosmo.struct_cleanup()
cosmo.empty()

When I use the raw_cl() call, I get a seg fault. While with the lensed_cl() call, I get

Traceback (most recent call last):
  File "scalars_tensors_test.py", line 13, in <module>
    cls = cosmo.lensed_cl(2000)
  File "classy.pyx", line 442, in classy.Class.lensed_cl (classy.c:5932)
classy.CosmoSevereError:

Error in Class: Can only compute up to lmax=0

The analogous configuration works in CLASS:

output = tCl,pCl
modes = s,t

Thanks! Nice work with CLASS and the interface.

Output correlation functions w(theta) instead/besides Cls

Hello,
In the CLASS documentation it is mentioned that the code can compute the angular correlation functions, but I did not find out how to request this output from the code. I am interested in the auto- and cross-correlation functions of counts and galaxy lensing at different redshifts.
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.