Bayesian Analysis of Neutron Star Mass and Radius Observations

User's Guide

This document describes the open-source MPI implementation of a Bayesian analysis of mass and radius data to determine the mass versus radius curve and the equation of state of dense matter. This package will principally be useful for those physicists and astrophysicists who are already familiar with C++ and are interested in modifying this code for their own use.

This code was originally supported by Chandra grant TM1-12003X.

This is a beta version. Use at your own risk.

Currently, bamr is dual-hosted as an SVN respostory at and a git repository at . This HTML documentation is hosted at

If you are considering using this code for your research, I encourage you to contact me so that I can help you with the details and so that you can let me know if and how this code is useful to you. Nevertheless, you are not required to contact me and I will be improving documentation and updating this code as time permits.



The bamr executable requires the installation of GSL (versions 1.15 and later), HDF5 (versions 1.8.4 and later), the current development version of O2scl (in the branches/dev folder of the O2scl distribution), and MPI (tested with openmpi-1.4.2). After these four packages are successfully installed, you will need to edit the makefile and then compile bamr before execution.


The most recent release version can be obtained from either of the following:

svn checkout svn:// bamr
git clone

Basic Usage

The basic usage is something like

./bamr -model twop -run -mcmc run1

to perform a one day run with model twop with the input file in

There are several variables which can be modified with the set command, e.g.

./bamr -model twop -set max_time 43200 -run -mcmc run2

An example of an MPI invocation is

mpirun -np 4 ./bamr -set model twop -run -mcmc run3 &

which runs with four processors on the current machine.

Also try

./bamr -help

which outputs some additional information on the relevant functions and parameters.

Data Files

The data files are HDF5 files (typically named with a .o2 extension) which contain one o2scl::table3d object giving the probability density of a neutron star observation as a slice in that table.

Output Files

Output is stored in HDF files with a prefix given by the argument to the mcmc command, one set of files for each processor. Output includes files with the following suffixes (where X is the processor index):

If the executable is run directly (without mpirun) then X is always zero.

Some Details

The basic functionality is provided in the bamr::bamr_class and each Monte Carlo point is an object of type bamr::entry. All of the "models" (EOS parameterizations) are children of bamr::model class.

If the initial guess has no probability, then the code will fail. This is indicated by the line "Initial weight zero." in the _scr file. The easiest fix is just to change the initial guess.

In order to make the output more efficient, the table representing the full Markov chain is divided up into tables with about 10,000 rows each. The total number of tables is stored in n_chains.

EOS Model

Some EOS models are already provided. New models (i.e. new children of the bamr::model class) must perform several tasks

Partial Function Call Stack

The top-level functions in the call stack are:

The operation of bamr::bamr_class::compute_weight() can be summarized with:

Change Log

April 2015: Added process.cpp and created new functions bamr::model::setup_params and bamr::model::remove_params() . Added several new models.


I would like to thank Paulo Bedaque, Ed Brown, Farrukh Fattoyev, Stefano Gandolfi, Jim Lattimer, and Will Newton for their collaboration on these projects.


Some of the references which contain links should direct you to the work referred to using its DOI identifer.

Bedaque15sv: P. Bedaque and A.W. Steiner, Phys. Rev. Lett. 114 (2015).

Lattimer14co: J.M. Lattimer and A.W. Steiner, Eur. Phys. J. A 50 (2014) 40.

Lattimer14ns: J.M. Lattimer and A.W. Steiner, Astrophys. J. 784 (2014) 123.

Steiner10te: A.W. Steiner, J.M. Lattimer, E.F. Brown, Astrophys. J. 722 (2010) 33.

Steiner12cn: A.W. Steiner and S. Gandolfi, Phys. Rev. Lett. 108 (2012) 081102.

Steiner13tn: A.W. Steiner, J.M. Lattimer, E.F. Brown, Astrophys. J. Lett. 765 (2013) 5.

Steiner15un: A.W. Steiner, S. Gandolfi, F.J. Fattoyev, and W.G. Newton, Phys. Rev. C 91 (2015) 015804.

Documentation generated with Doxygen. Bamr documentation is under the GNU Free Documentation License.