Skip to content

Commit

Permalink
adding a sample psd file, and updated README file and warnings in pet…
Browse files Browse the repository at this point in the history
…turbations.c
  • Loading branch information
Julien Lesgourgues committed Nov 7, 2011
1 parent 8068fe3 commit ddf69bc
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 21 deletions.
38 changes: 21 additions & 17 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -66,40 +66,44 @@ if enough users ask for it...

PLOTTING UTILITY

Since version 1.3, the package includes a convenient plotting script
called class-plot, written by Benjamin Audren. It can plot the Cl's or
P(k) for one or two models, as well as their ratio or percentage
difference. A convenient feature is that percentage differences can be
shown even when two spectra are not sampled in the same points, as it
is often the case when comparing matter power spectra P(k) for various
models - in that case the script uses some interpolation scheme. The
type of spectrum (C_l or P(k)) is detected automatically (provided
that the file name endings are set by CLASS in the standard way), and
axes are labelled accordingly.

class-script is written in python, but you don't need to know anything
Since version 1.2, the package includes a convenient plotting script
called CPU (Class Plotting Utility), written by Benjamin Audren. It
can plot the Cl's or P(k) for one or two models, as well as their
ratio or percentage difference. A convenient feature is that
percentage differences can be shown even when two spectra are not
sampled in the same points, as it is often the case when comparing
matter power spectra P(k) for various models - in that case the script
uses some interpolation scheme. The type of spectrum (C_l or P(k)) is
detected automatically (provided that the file name endings are set by
CLASS in the standard way), and axes are labelled accordingly.

CPU is written in python, but you don't need to know anything
about python for using it, for you it will just be a simple command to
use on your terminal. However it will only work on systems with a
recent enough version of python including the 'scipy' package
(scientific python), and a recent enough version of gnuplot. You may
need to install some of them by yourself. These are standard free
facilities easy to download from the web. You don't need to compile
anything, if scipy and gnuplot are installed on your computer, the
class-plot command will work immediately.
CPU command will work immediately.

You can plot a spectrum produced by CLASS (or by another code) and
stored e.g. in the file output/xxx.dat with:

> python class-plot output/xxx.dat
> python CPU output/xxx.dat

or two different spectra with:

> python class-plot output/xxx.dat output/yyy.dat
> python CPU output/xxx.dat output/yyy.dat

You can get a list of all available options by typing

> python class-plot --help
> python CPU --help

These options allow you to choose between linear and log scale, to
plot ratios or relative differences between two files, to send the
output in a postscript file instead of the screen, etc.
output in a postscript file instead of the screen, etc.

If you put the path to class plot in the list of default paths, or if
you creat an alias, you may be able to type directly the command
'CPU' instead of 'python CPU'.
2 changes: 1 addition & 1 deletion include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define __COMMON__

#define _VERSION_ "v1.3"
#define _SVN_VERSION_ "4847"
#define _SVN_VERSION_ "4853"

#define _TRUE_ 1 /**< integer associated to true statement */
#define _FALSE_ 0 /**< integer associated to false statement */
Expand Down
100 changes: 100 additions & 0 deletions psd_FD_single.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
0.0000000e+000 4.0314418e-003
1.2121212e-001 3.7874107e-003
2.4242424e-001 3.5451614e-003
3.6363636e-001 3.3064240e-003
4.8484848e-001 3.0728285e-003
6.0606061e-001 2.8458621e-003
7.2727273e-001 2.6268350e-003
8.4848485e-001 2.4168557e-003
9.6969697e-001 2.2168165e-003
1.0909091e+000 2.0273889e-003
1.2121212e+000 1.8490284e-003
1.3333333e+000 1.6819863e-003
1.4545455e+000 1.5263281e-003
1.5757576e+000 1.3819553e-003
1.6969697e+000 1.2486299e-003
1.8181818e+000 1.1259993e-003
1.9393939e+000 1.0136210e-003
2.0606061e+000 9.1098552e-004
2.1818182e+000 8.1753726e-004
2.3030303e+000 7.3269281e-004
2.4242424e+000 6.5585650e-004
2.5454545e+000 5.8643326e-004
2.6666667e+000 5.2383885e-004
2.7878788e+000 4.6750783e-004
2.9090909e+000 4.1689940e-004
3.0303030e+000 3.7150144e-004
3.1515152e+000 3.3083316e-004
3.2727273e+000 2.9444641e-004
3.3939394e+000 2.6192609e-004
3.5151515e+000 2.3288982e-004
3.6363636e+000 2.0698701e-004
3.7575758e+000 1.8389754e-004
3.8787879e+000 1.6333015e-004
4.0000000e+000 1.4502072e-004
4.1212121e+000 1.2873034e-004
4.2424242e+000 1.1424347e-004
4.3636364e+000 1.0136608e-004
4.4848485e+000 8.9923795e-005
4.6060606e+000 7.9760183e-005
4.7272727e+000 7.0735118e-005
4.8484848e+000 6.2723239e-005
4.9696970e+000 5.5612518e-005
5.0909091e+000 4.9302948e-005
5.2121212e+000 4.3705328e-005
5.3333333e+000 3.8740163e-005
5.4545455e+000 3.4336653e-005
5.5757576e+000 3.0431782e-005
5.6969697e+000 2.6969493e-005
5.8181818e+000 2.3899944e-005
5.9393939e+000 2.1178837e-005
6.0606061e+000 1.8766816e-005
6.1818182e+000 1.6628928e-005
6.3030303e+000 1.4734139e-005
6.4242424e+000 1.3054902e-005
6.5454545e+000 1.1566771e-005
6.6666667e+000 1.0248056e-005
6.7878788e+000 9.0795173e-006
6.9090909e+000 8.0440884e-006
7.0303030e+000 7.1266354e-006
7.1515152e+000 6.3137388e-006
7.2727273e+000 5.5935005e-006
7.3939394e+000 4.9553726e-006
7.5151515e+000 4.3900052e-006
7.6363636e+000 3.8891104e-006
7.7575758e+000 3.4453427e-006
7.8787879e+000 3.0521921e-006
8.0000000e+000 2.7038891e-006
8.1212121e+000 2.3953211e-006
8.2424242e+000 2.1219577e-006
8.3636364e+000 1.8797842e-006
8.4848485e+000 1.6652437e-006
8.6060606e+000 1.4751843e-006
8.7272727e+000 1.3068135e-006
8.8484848e+000 1.1576570e-006
8.9696970e+000 1.0255226e-006
9.0909091e+000 9.0846835e-007
9.2121212e+000 8.0477343e-007
9.3333333e+000 7.1291348e-007
9.4545455e+000 6.3153795e-007
9.5757576e+000 5.5945039e-007
9.6969697e+000 4.9559083e-007
9.8181818e+000 4.3902025e-007
9.9393939e+000 3.8890677e-007
1.0060606e+001 3.4451341e-007
1.0181818e+001 3.0518733e-007
1.0303030e+001 2.7035015e-007
1.0424242e+001 2.3948953e-007
1.0545455e+001 2.1215157e-007
1.0666667e+001 1.8793419e-007
1.0787879e+001 1.6648120e-007
1.0909091e+001 1.4747706e-007
1.1030303e+001 1.3064224e-007
1.1151515e+001 1.1572912e-007
1.1272727e+001 1.0251835e-007
1.1393939e+001 9.0815608e-008
1.1515152e+001 8.0448749e-008
1.1636364e+001 7.1265286e-008
1.1757576e+001 6.3130135e-008
1.1878788e+001 5.5923630e-008
1.2000000e+001 4.9539765e-008
6 changes: 3 additions & 3 deletions source/perturbations.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ int perturb_init(
"Vectors not coded yet");

if ((ppt->gauge == newtonian) && (pba->has_ncdm == _TRUE_)) {
printf("Warning: integrating the ncdm equations in the newtonian gauge requires more precision than in the synchronous one. You should set tol_ncdm to a smaller value than usual, and the Cls for l<50 wil not be accurate. Currently, you have tol_ncdm set to %e; for indication, 1.e-5 is necessary for sub-percent precision for l>50\n",ppr->tol_ncdm);
printf("Warning: integrating the ncdm equations in the newtonian gauge requires more precision than in the synchronous one. You should set tol_ncdm to a smaller value than usual, and the Cls for l<50 wil not be accurate. Currently, you have tol_ncdm set to %e; for indication, 1.e-5 is necessary for sub-percent precision for l>50.\n",ppr->tol_ncdm);
}

if (ppt->has_niv == _TRUE_) {
printf("Warning: niv initial conditions should be rechecked\n");
printf("Warning: the niv initial conditions in CLASS (and also in CAMB) should still be double-checked: if you want to do it and send feedback, you are welcome!\n");
}

if ((ppt->gauge == newtonian) && ((ppt->has_bi == _TRUE_) || (ppt->has_cdi == _TRUE_) || (ppt->has_nid == _TRUE_))) {
printf("Warning: isocurvature modes are more stable and accurate in synchronous gauge. Take results with care\n");
printf("Warning: isocurvature modes are more stable and accurate in the synchronous gauge. Take these results with care.\n");
}

if (ppt->has_tensors == _TRUE_)
Expand Down

0 comments on commit ddf69bc

Please sign in to comment.