skip to navigation
skip to content

pypico 3.1.0

Quickly compute the CMB powerspectra and matter transfer functions.

Latest Version: 3.3.0


To install PICO type:

$ python install

(If you don’t have root access, you can append the option --user which installs PICO under your home directory.)


Once you have PICO installed, to do anything you’ll need some data files which actually contain interpolated data. You can find them on the PICO website at

After that, typical usage is loading a PICO data file:

>> import pypico
>> pico = pypico.load_pico("example_pico_file.dat")

To show possible inputs parameters and output values use:

>> pico.inputs()
>> pico.outputs()

And finally, to calculate output values, run:

>> pico.get(**inputs)

where inputs is a dictionary with keys for each input returned by pico.inputs()

Installing Plugins for CAMB, CosmoMC, etc..

If all you’d like to do it use PICO from Python with various data files then you do not need to do anything in this section. If on the other hand, you’d like to either

  • Plug PICO into your code which currently calls CAMB_GetResults
  • Plug PICO into CosmoMC

then you’ll need to follow these instructions.


When you installed PICO, a static library libpico.a was created which allows PICO to be called from C, C++, Fortran, or any other language which can understand the symbols in the library. To link your code against this library, PICO provides an easy way to get include and link flags on your platform. To print out the necessary flags, call:

$ python -c "import pypico; print pypico.get_include()"
$ python -c "import pypico; print pypico.get_link()"

Plugin Folder

You can find the various plugin files in a folder plugin in the archive. If you installed PICO via pip or easy_install, you can find the location of the plugins by running:

$ python -c "import pypico; print pypico.get_folder()"

CAMB Plugin

If your code is set up to call the CAMB function CAMB_GetResults, then it should be trivial to use the PICO version called PICO_GetResults instead. The PICO version will fall back on the CAMB version if called with parameters for which it cannot calculate the relevant quantities.

To install the CAMB plugin, do the following:

  • Copy plugins/camb/pico_camb.f90 to the folder containing your code
  • Add a call fpico_load(file) to load a PICO datafile.
  • Replace CAMB_GetResults with PICO_GetResults
  • Compile your code, making sure to use the correct include/link flags (as described above).

CosmoMC Plugin

PICO can also be plugged into CosmoMC.

To install the CosmoMC plugin, do the following:

  • Copy plugins/cosmomc/CMB_Cls_pico.f90 and plugins/camb/pico_camb.f90 to the CosmoMC source folder
  • Replace driver.f90 in the CosmoMC source folder with the one in plugins/cosmomc
  • In your CosmoMC Makefile, replace references to CMB_Cls_simple with references to CMB_Cls_pico
  • Add the correct include/link flags to the Makefile (as described above).
  • Add the a key pico_datafile to your parameter file.

CosmoSlik Plugin

To install the CosmoSlik plugin, copy plugins/cosmoslik/ to the cosmoslik/models/ folder.


The main author of PICO is Marius Millea (feel free to send questions/comments to

PICO was originally created by Chad Fendt and Ben Wandelt (see

File Type Py Version Uploaded on Size
pypico-3.1.0.tar.gz (md5) Source 2012-06-20 16KB