Another Python binding of the CMB Boltzmann code CLASS, v3, with access to velocity power spectra.
- numpy
- cython
The CLASS code will be downloaded and compiled at installation.
python -m pip install git+https://github.com/adematti/pyclass
If you wish to use clang compiler (instead of gcc), you may encounter an error related to -fopenmp
flag.
In this case, you can try to export:
export CC=clang
Before installing pyclass. This will set clang OpenMP flags for compilation (see lesgourg/class_public#405). Note that with Mac OS gcc can point to clang.
See the tests of the code in pyclass/tests/
for examples of using each of the main CLASS modules.
To implement a CLASS extension extension
, just copy-paste base
into e.g. extension
,
and make the changes to the Cython extension/binding.pyx
and extension/cclassy.pxd
files for the specific extension.
That's it! Upon installation (pip install --user .
), the extension is automatically compiled (together with base
), and can be imported as:
from pyclass.extension import *
This code heavily relies on classylss: http://classylss.readthedocs.io/.