Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Copyright (C) 2016 Jeremy Sanders <>

MBProj2 is released under the GNU Library General Public License version 2 or greater. See the file COPYING for details.

Described in Hydrostatic Chandra X-ray analysis of SPT-selected galaxy clusters - I. Evolution of profiles and core properties, J.S. Sanders, A.C. Fabian, H.R. Russell and S.A. Walker, submitted to MNRAS

More documentation can be found at

Note: MBProj2D is a newer version of this code which fits images instead of profiles. It is currently being more actively developed:


MBProj2 (MultiBand Projector 2) is a code which forward-models surface brightness profiles of galaxy clusters. Using a single X-ray band the model would be sensitive to the density of the intracluster medium (ICM). By using multiple bands the code is able to model the temperature variation within the cluster. Given sufficient energy bands the metallicity of the ICM can also be fitted.

MBProj2 can assume hydrostatic equilibrium using a mass model. From this model (with an outer pressure parameter and the density profile) the pressure profile can be computed for the cluster. This allows the temperature to be computed on small spatial scales, which would otherwise not have enough data to compute the temperature independently. If no hydrostatic equilibrium is assumed then MBProj2 can fit for the temperature of the ICM instead.

The defined model is normally first fit to the surface brightness profiles. MCMC using the emcee module is used to compute a chain of model parameters, from which posterior probability distributions can be computed for a large number of model and physical parameters.


MBProj2 requires the following:

  1. Python 2.7+ or 3.3+ or greater
  2. emcee (Python module)
  3. h5py (Python module)
  4. numpy (Python module)
  5. scipy (Python module)
  6. PyYAML (Python module)
  7. xspec
  8. veusz (optional plotting)

The Python module requirements can be installed using a Unix package manager, the pip Python tool or a Python distribution such as Anaconda, as appropriate for your setup. Please see the link above for installing xspec. Before using MBProj2, make sure you have initialised HEADAS.


The standard way to install this module is to use the provided script:

$ python build
$ python install

This will place the module in the default install location. Please see the Python distutils documentation if you want to choose different install locations.

As the module is pure Python, if you want to install it manually you can copy the mbproj2 directory somewhere and modify your PYTHONPATH environment variable to include the directory where it is located.

Using the module

The code can either be used as a Python module or driven using the program mbproj2_compat using an external configuration file in YML format. The second option is designed to be compatible with the format of the file used by the previous version MBPROJ. This is not properly documented, but the interested user can examine the source code.

The best way to understand how to use the module is to look at the example source code provided with the distribution. The API documentation provided details the various classes which make up mbproj2.

The usual procedure to analyse data involves the following:

  • Use the redshift of the object to make a Cosmology object
  • Make an Annuli object which describes the annuli geometry in the count profiles
  • Load cluster count profiles into Band objects (either manually or with loadBand).
  • Construct a Data object from the list of Band objects.
  • Make the density and metallicity model component profiles by using one of the provided Cmpt model component objects (e.g. CmptFlat or CmptProfile).
  • Make the mass model component (if assuming hydrostatic equilibrium) from one of the CmptMass objects.
  • Use ModelHydro to make a model from the various components.
  • Get a list of default parameters and modify if necessary.
  • Construct a Fit object which takes the model, parameters and data.
  • Find the best fitting set of parameters.
  • Use a MCMC object to do the Markov Chain Monte Carlo and write the chain to a HDF5 file.
  • Use replayChainPhys to construct chains of physical parameters and savePhysProfilesHDF5 to write profiles of median values.


Multi-Band x-ray surface brightness PROJector 2







No releases published


No packages published