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?
Star-formation history recovery from spectroscopy (see Carnall et al. 2019b)
Identification of z > 3 quiescent galaxies from photometry (see Carnall et al. 2020)
Bagpipes has been used in ~130 papers as of April 2023. For more example use cases take a look at this ADS library listing papers that use Bagpipes.
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).
The simplest way to install MultiNest if you have an anaconda python disribution is with the command conda install -c conda-forge multinest.
Failing this, see point 1 of the “on your own computer” section of the PyMultiNest installation instructions. The instructions for specific cases below may also be of use:
In my experience, the sequence of commands necessary to install MultiNest on an intel 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
On an Apple Silicon mac, the sequence of commands might be slightly different because homebrew changed its default installation path.
git clone https://github.com/JohannesBuchner/MultiNest brew install gcc export DYLD_LIBRARY_PATH="/opt/homebrew/bin/gcc-13:$DYLD_LIBRARY_PATH" cd MultiNest/build cmake .. make sudo make install cd ../.. rm -r MultiNest
Note: Depending on when you install, the gcc version might be different. One can check gcc’s version with brew info gcc and check if it is still installed at the right place ls /opt/homebrew/bin/gcc*. If your version differs from gcc-13, then you can easily update the third command with the correct path.
If you are running a Linux operating system, or have MacPorts instead of Homebrew, you may run into additional issues. I may be able to provide advice if you get stuck.
Published papers and citing the code
Bagpipes is described primarily in Section 3 of Carnall et al. (2018), with further development specific to spectroscopic fitting described in Section 4 of Carnall et al. (2019b). These papers are the best place to start if you want to understand how the code works.
Please note development of the code has been ongoing since these works were published, so certain parts of the code are no longer as described. Please inquire if in doubt.
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:
A few of the excellent projects Bagpipes relies on are: