Bagpipes

Bayesian Analysis of Galaxies for Physical Inference and Parameter EStimation is a state of the art Python code for modelling galaxy spectra and fitting spectroscopic and photometric observations.

I hope you will find everything you need to know here, however feel free to get in touch if you have further questions, or to get an opinion on specific use cases. I’ve recently added a latest news page, which I’ll use to track updates to the code and any issues people make me aware of.

What can Bagpipes do?

_images/sfh_from_spec.png

Star-formation history recovery from spectroscopy (see Carnall et al. 2019b)

_images/z3_passive.png

Identification of z > 3 quiescent galaxies from photometry (see Carnall et al. 2020)

Bagpipes has been used in ~30 refereed publications as of Jan 2021. For more example use cases take a look at papers that cite the bagpipes paper, e.g. Carnall et al. (2019a), Williams et al. (2019) and Wild et al. (2020).

Source and installation

Bagpipes is developed at GitHub, however the code cannot be installed from there, as the large model grid files aren’t included in the repository. The code should instead be installed with pip:

pip install bagpipes

All of the code’s Python dependencies will be automatically installed. The only non-Python dependency is the MultiNest nested sampling algorithm (used only for fitting). To install MultiNest see point 1 of the “on your own computer” section of the PyMultiNest installation instructions.

In my experience, the sequence of commands necessary to install MultiNest on a mac (with Homebrew installed) is as follows:

git clone https://github.com/JohannesBuchner/MultiNest
brew install gcc49
export DYLD_LIBRARY_PATH="/usr/local/bin/gcc-4.9:$DYLD_LIBRARY_PATH"
cd MultiNest/build
cmake ..
make
sudo make install
cd ../..
rm -r MultiNest

If you have MacPorts instead of Homebrew you may run into additional issues. I may be able to provide advice if you get stuck.

Citation

Bagpipes is described in Section 3 of Carnall et al. (2018), if you make use of Bagpipes, please include a citation to this work in any publications. Please note development of the code has been ongoing since this work was published, so certain parts of the code are no longer as described.

Getting started

The best place to get started is by looking at the iPython notebook examples. It’s a good idea to tackle them in order as the later examples build on the earlier ones. These documentation pages contain a more complete reference guide.

Bagpipes is structured around three core classes:

  • model_galaxy: for generating model galaxy spectra

  • galaxy: for loading observational data into Bagpipes

  • fit: for fitting models to observational data.

Acknowledgements

A few of the excellent projects Bagpipes relies on are: