The release of our next paper is imminent (yay!), and so it’s time for another code release. I try to make all of my code, or at least a substantial fraction of it, publicly available. This enables other people to reproduce and check my work if they want to. It also allows them to build off my code and do cool new things, rather than having to spend months solving problems that, well, have already been solved. That’s the theory, anyway – I only know of a couple of people who’ve actually poked around in the code, or tried to use it for something. But hey, you’ve got to start somewhere. For posterity, I’ve posted the closest thing I have to release notes below.
Bubble is an umbrella project for a number of numerical codes for general relativistic cosmology that I have written in Python and C++. Much of the code here is a perpetual “work in progress”, and is not really intended for “useful” public release. It is provided mostly so that people can inspect my code, and use and adapt it if they wish, but I’ve made no attempt to factor it into an easy-to-use library. That said, if you would like to use the code, please email me and I’ll be very happy to help you get it working. If you notice any problems (and I encourage you to look for them!), please let me know, and I’ll either fix them myself, or merge your patches.
What does it do?
There are a number of different codes contained within this project.
bubblesolves the evolution equations for general Lemaitre-Tolman-Bondi models, including those with a variable “bang time”. It can solve radial null geodesics, and output observables down the lightcone and on spatial slices (kSZ, H(z), dL(z) etc). It isn’t super-fast, but it’s fast enough to do MCMC, it’s very general, and seems to be quite robust. It’s written in C++, and depends on GSL.
mcmcis a homebrew Markov Chain Monte Carlo implementation, using the Metropolis-Hastings algorithm, for MCMC’ing over LTB models. It’s written in Python, and needs a built
bubblebinary in another directory for parts of it to work. It also has some functions that depend on a customised version of CosmoMC/CAMB. Email me if you need more information. There are quite a few scripts for outputting plots and analysing the resulting MCMC chains too.
pyltbis a Python module for solving the LTB equations. Some parts are faster than
bubble, and some are slower. It’s not necessarily able to solve null geodesics (at the moment, at least). It can, however, perform Buchert averaging and output a variety of acceleration measures (e.g. local volume acceleration and Kristian-Sachs deceleration parameter monopole). It’s very easy to modify, and to integrate into other Python code. It can also be used to solve the Friedmann equations (it has a few analytic solutions to the Friedmann equations built in too), and to construct “spherical collapse” models made up of multiple disjoint FLRW regions. Raytracing is possible through these.
accelis a varied collection of Python code for producing plots and manipulating spherical collapse models and LTB models. Much of the code is concerned with raytracing through the former, and Buchert averaging both of them. It depends on
pyltbvery heavily. The code was used to produce the results in my 2012 paper on types of cosmic acceleration (see below).
Using the code
Large segments of the code have been tested for correctness and used to produce scientific results, but if you do use it for your own work, I suggest that you perform your own tests as well. This code release is part of my commitment to producing open, reproducible scientific results. If you do use it, please cite the relevant paper:
bubble, cite arXiv:1108.2222
mcmc, cite arXiv:1108.2222
pyltb, cite P. Bull and T. Clifton, 2012 (will be updated soon)
accel, cite P. Bull and T. Clifton, 2012 (will be updated soon)
There is some inter-dependence between the code in the different branches. For example,
mcmc requires a pre-built binary of
bubble for some of its functions to run. Likewise, the code in
accel depends on
pyltb. You will find that you need to edit makefiles and so on to get some things working. It should be reasonable self-explanatory, but please do email me if you get stuck.
The best way of getting the code is to clone the appropriate git repository.
Can I modify the code?
Yes, you can. In fact, I actively encourage it! It would be great if you could release any modifications that you make to the code, so that they can be shared by everyone. I’m not a stickler about it, though, as long as: (a) you’re nice about it, (b) make good faith attempts to describe and/or share your modifications if asked, and (c) you give proper credit. In return, I promise to be super nice to you, and give you all the help I can. You should, however, be aware that `bubble’ links against GSL, so if you publicly release it, or a modified version of it, you must abide by the GPL.
Please do get in touch with me if you have any questions, need help with something, want a general discussion about the science, or have criticisms to make.
Astrophysics, University of Oxford
phil.bull -at- astro.ox.ac.uk