Clone wiki

cosmosis / development

Development version

We add cosmosis changes and new features to a "development" version (or "branch") before merging them into a main numbered release. You can use this version to get new features and bug fixes, but expect more bugs and other issues, which we'd be grateful if you'd report to us - please let us know that you are using the development version.

Getting the development version

This commands will take you from the master version to the current development version:

update-cosmosis --develop

Or if you would like to do things manually:

git checkout develop
git pull
cd cosmosis-standard-library
git checkout develop
git pull
cd ..

If you have made changes to the cosmosis code that would conflict with changes in the development version then this will refuse and give you a warning. If you are happy to lose those changes then run:

git checkout .
cd cosmosis-standard-library
git checkout .
cd ..

and then re-run the first set of commands.

Changes in the current development version

Python 3

  • The whole of CosmoSIS is now compatible with both python 2.7 and python 3.5 and above. This makes some pieces of code look a bit more confusing but should not have changed any behaviour. It also means that there are two new python dependencies required: "future" and "configparser". Both of these can be installed with pip: pip install future configparser.

Standard Library Changes

New modules

  • binwise_bias: per-bin or globally constant biases
  • bin_r: stochastic biases per-bin or globally
  • riess16: Newest Riess et al (2016) measurements of H0
  • cl_to_xi_fullsky: Full-sky (non-limber) calculation of correlation function w(theta)

Existing module improvements

  • Add use_lin_power option to no_bias to allow using linear matter power -> galaxy power
  • Add distances_to_lss and n_highz_distance option to camb to distances all the way to the last-scattering surface.
  • Add options to ia_z_powerlaw to use different named sections and use a z0 pivot redshift, and to apply to galaxy-intrinsic correlations
  • Improve error handling in camb so various error scenarios now return an error status instead of quitting
  • Add suffix option to 2pt_like to allow looking at various sets of spectra
  • 2pt likelihood now fails with clearer error messages in several cases
  • save_2pt module can now save correlation functions as well as C_ell
  • Add upsampling option to load_nz and load_nz_fits
  • Add prefix_section and prefix_extension bool options to load_nz_fits to customize whether the NZ_ prefix is applied to the name of the input fits extension and/or the section in the block where it is saved.
  • Added prefix_nz_section to save_2pt to control how the resulting FITS file is saved.
  • Add interpolation and perbin options to photoz_bias to change how interpolation is done and whether to use a global shift
  • Add perbin option to add_intrinsic to look for A0, A1, ... IA parameters
  • Add M_ap and N_ap statistics to cl_to_xi_nicaea
  • Increase speed of Limber integrator, and expose tolerance parameters
  • Customize shear_m_bias with cal_section, cl_section, and cross_section options
  • Add BB Intrinic alignment spectra to project_2d
  • Add fatal_errors and save_kernel_zmax options in project_2d
  • Fix spelling of "Calculator" in project_2d
  • Add more checks for errors when running the Limber integral.
  • Fix bug in Kirk, Rassat, Host, Bridle model in NLA intrinsic alignment model.
  • save the cosmomc_theta parameter from camb.

Module Changes & Fixes

  • Change the order that std lib modules output distances so that they start at z=0
  • Bugfix to Clerkin bias model so it works at all.
  • Fix Omega_nu not being included in Omega_m in consistency and Takahashi Halofit
  • Fix memory leaks in MGCamb interface
  • Fix bin-only cuts not being applied in 2pt likelihood
  • Move Suyu strong lensing likelihoods into general time_delay_likelihood module
  • Turn some GSL exits into python errors
  • Fix memory leak in JLA

CosmoSIS Changes

Runtime upgrades

  • Add chaining of samplers together in a sequence, getting hints (start point, proposal, etc., from previous samplers.
  • If faulthandler package available then use it to dump traceback on signal (e.g. segfault).
  • Add experimental fault handler flat --experimental-fault-handling to provide a trace of where segmentation faults and other C/C++/Fortran-level errors occurr.
  • During the setup phase under MPI only the master process will print any output. You can print out from all the processes by adding the parameter pool_stdout to the [runtime] section.
  • The new --pdb flag runs the code under the python debugger PDB. In the even of an error in python code the code starts an interactive interpreter so you can figure out what went wrong.
  • The new --smp flag runs the code under the python multiprocessing mode - a shared memory parallel mode that can be used to run under many cores on the same node without MPI. This does not work for multinest.

Parameters and prior upgrades

  • Priors printed for all parameters when code is run.
  • Add methods to generate samples from priors and go from [0,1] to parameter prior.
  • If the parameter "likelihoods" is not set then all detected likelihoods will be used.
  • The default output format is now the "text" format so that parameter can be omitted

New tools

  • Script to extract parameter files from the header of a chain
  • Script to generate samples from a Fisher matrix output

Postprocessing improvements

  • Allow custom legends not just file names
  • Add option --run-max-post to run the pipeline for the maximum-posterior sample in the chain
  • Plot contours in more sensible order
  • Normalize 1D Fisher plots to peak at 1.0
  • Add plots for Star sampler (see below)
  • Add thinning for emcee sampler
  • Save more statistics about chain, including upper and lower 68/95% limits and asymmetric error bars
  • Add Gelman-Runbin statistics during post-processing


  • Add apriori sampler that generates samples from the prior and computes their likelihoods
  • Add the pmaxlike sampler, a parallel maximum-likelihood sampler using Conjugate-Gradient descent
  • Add the star sampler, which samples along 1D slices in each direction in parameter space, useful for testing theory predictions
  • Allow initializing emcee sampling from a covariance matrix
  • Add option to the Fisher sampler using the NumDiffTools packages to do the derivatives
  • Expose parameter wrapping in multinest sampler
  • Fix multinest evidence by incorporating priors correctly
  • Update to multinest 3.10


  • In demos 5 and 9 the M parameter is now varied, as it should be.
  • Demo 15 now uses the Clerkin et al model for galaxy bias


  • Fixes to example manual setup file.
  • Update to newer more streamlined UPS packages.
  • A setup script for the NERSC supercomputer facility is now in the config directory.


  • Fixed compilation failure when using newer gfortran versions to do with ordering of declarations

Misc / Quality of Life

  • More output when saving grid to block fails
  • Add include_norm option to Gaussian likelihoods letting you choose to include constant log |C|
  • Allow KDE code to be used in higher dimensions
  • Documentation strings are now included for most core cosmosis objects
  • Various changes to config handling and module loading to ease scripting cosmosis.

Developer TODO:

Need module.yaml files for these: - supernovae/salt2