---
title: "Recompute X-COP hydrostatic masses and a toy SZ cluster survey"
description: "Refit frozen public X-COP profiles of A2029 and A2319, get three mass estimates each, and run a toy SZ survey that shows how the assumed bias sets cosmology."
canonical_url: "https://sandboxphysics.com/stories/cluster-mass-calibration/recompute-xcop-hydrostatic-masses/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/cluster-mass-calibration/recompute-xcop-hydrostatic-masses/"
last_modified: "2026-11-22"
---

[Weighing galaxy clusters with X-rays, SZ and lensing](https://sandboxphysics.com/stories/cluster-mass-calibration/)

# Recompute X-COP hydrostatic masses and a toy SZ cluster survey

Sandbox Physics · 2026-11-22

Planck puts Abell 2029 at $7.04\times10^{14} M_\odot$. A fit to the distortion of background galaxies gives $12.1\times10^{14} M_\odot$. Download the data to compare those estimates with X-ray pressure and to see what changes when you use the same physical radius.

The first part reruns the fits for Abell 2029 and Abell 2319 from the public X-COP profiles. The second uses a simulated survey to follow the mass difference into a count. Start with [hydrostatic mass bias and cluster counts](https://sandboxphysics.com/stories/cluster-mass-calibration/mass-bias-and-cluster-counts/) if you want the derivation.

## Get the files

Download and unpack the [complete replay ZIP](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/xcop-mass-calibration-replay.zip). The individual files are also available.

- [README.md](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/README.md): how to run, file layout and failure cases
- [xcop\_hydrostatic\_masses.py](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/xcop_hydrostatic_masses.py): profile fits and the three mass estimates
- [cluster\_mass\_function.py](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/cluster_mass_function.py): halo mass function
- [cluster\_count\_selection.py](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/cluster_count_selection.py): toy SZ survey
- [compare\_catalogues.py](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/compare_catalogues.py): matches the Planck and CFHT masses and compares them with the X-COP profiles
- [observed-catalogues.json](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/observed-catalogues.json): frozen PSZ2 records and the Abell 2029 weak-lensing table row
- [requirements.txt](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/requirements.txt): NumPy and SciPy versions
- [reproduce.py](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/reproduce.py): runs everything and compares with the frozen outputs
- [xcop-a2029.json](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/xcop-a2029.json) and [xcop-a2319.json](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/xcop-a2319.json): frozen X-COP columns
- [expected-outputs.json](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/expected-outputs.json) and [provenance.json](https://sandboxphysics.com/stories/cluster-mass-calibration/materials/provenance.json): outputs, sources and SHA-256 checksums

The ZIP preserves the folders. Create a Python environment with the versions listed in requirements.txt and run the replay.

```
python3 -m pip install -r requirements.txt
python3 reproduce.py
```

The run takes a few seconds and exits with status 0 when every number agrees with expected-outputs.json within its tolerance.

## Step 1: read an input file

Each input file holds columns copied unchanged from the X-COP FITS tables for one cluster, the SHA-256 of every FITS file and of the release archive, and a header with the published redshift, $R_{500}$, $M_{500}$ and the pressure unit $P_{500}$. Open xcop-a2029.json and find:

- density: deprojected electron density NE in ${\rm cm^{-3}}$ between radii R\_IN and R\_OUT in kpc, with lower and upper bounds.
- pressureXRay: pressure P\_X in units of $P_{500}$ at radius RW\_X in units of $R_{500}$.
- pressureSZ: pressure P\_SZ from Planck at RW\_SZ. The FITS header says P/K500. Ghirardini et al. plot both pressure profiles in units of the same pressure scale in Figure 4.
- gasFraction: the published gas fraction profile.

The team asks users to cite three papers: Ghirardini et al. for thermodynamic profiles, Ettori et al. for masses and Eckert et al. for gas fractions. [Universal thermodynamic properties of the intracluster medium in the X-COP sample](https://arxiv.org/abs/1805.00042v2) [Hydrostatic mass profiles in X-COP galaxy clusters](https://arxiv.org/abs/1805.00035v3) [Non-thermal pressure support in X-COP galaxy clusters](https://arxiv.org/abs/1805.00034v2)

## Step 2: fit density and pressure

fit\_density fits $\ln n_{\rm e}$ with a one-component form of the Vikhlinin et al. density model. [Chandra sample of nearby relaxed galaxy clusters, Eq. 3](https://arxiv.org/abs/astro-ph/0507092v1) fit\_pressure fits all X-ray and SZ points together with a generalised NFW profile, inner slope fixed at 0.3081 as in Arnaud et al. [The universal galaxy cluster pressure profile from REXCESS, Eq. 12](https://arxiv.org/abs/0910.1234v1)

The SZ points get one free scale factor. Where SZ and X-ray points overlap, the SZ values are lower: the median ratio is 0.73 for A2029 and 0.89 for A2319, and across all 12 clusters in the release it ranges from 0.73 to 1.24. A single profile could not pass through both sets. The fitted factors are 0.756 and 0.922, so the SZ points constrain the outer shape but not the normalisation.

The printed $\chi^2$ is 75.8 for 24 pressure points in A2029 and 252 for 29 points in A2319. Treat these as weighted residual scores. The points are correlated and this calculation uses their individual error bars.

## Step 3: hydrostatic mass and the cluster edge

analyse\_cluster evaluates

$$
M(<r)=-\frac{r^2}{G\mu m_{\rm p}n_{\rm e}}\,\frac{\mathrm dP_{\rm e}}{\mathrm dr},\qquad \mu=0.61,
$$

and finds $R_{500}$ where the mean enclosed density reaches $500\rho_{\rm c}(z)$ for $H_0=70$ and $\Omega_{\rm m}=0.3$. The profile measures electron pressure. Hydrostatic balance here assumes thermal pressure supports all the gas against gravity.

**Table 5.1** Our hydrostatic fits against the published X-COP values.

| Cluster | our $R_{500}$ (kpc) | published | our $M_{500}$ ($10^{14}\ M_\odot$) | published | ratio |
| --- | --- | --- | --- | --- | --- |
| A2029 | 1393 | 1414 | 8.28 | 8.65 | 0.957 |
| A2319 | 1361 | 1368 | 7.57 | 7.68 | 0.985 |

The mass depends on the logarithmic pressure slope at $R_{500}$: $-2.69$ for A2029 and $-2.61$ for A2319. For A2029 the fit sits on the bound of the outer slope parameter. The parameters trade off there, but the slope at $R_{500}$ stays put.

## Step 4. Three mass estimates from one data set

The script then integrates the gas mass with $\rho_{\rm gas}=\mu m_{\rm p}(n_{\rm e}+n_{\rm p})$ and $n_{\rm e}=1.17n_{\rm p}$, and forms:

1. the hydrostatic gas fraction at our $R_{500}$: 0.140 for A2029, 0.187 for A2319, against published 0.140 and 0.190;
2. the mass at which the gas fraction would equal the universal 0.131: 9.22 and 14.7;
3. the mass that the Planck X-ray-calibrated relation assigns to our spherical $Y_{500}$: 8.44 and 10.0. [Planck 2015 results XXIV, Sec. 1 and Eq. 7](https://arxiv.org/abs/1502.01597v3)

For A2029, $1-0.131/0.140=0.065$ is a constant non-thermal fraction consistent with the gas fraction. For A2319 it is 0.30.

## Step 5. Compare with the catalogues

**Table 5.2** Masses at a mean density of $500\rho_{\rm c}(z)$ in units of $10^{14}\,M_\odot$.

| Cluster | X-COP hydrostatic | Planck PSZ2 proxy | CFHT weak lensing, NFW |
| --- | --- | --- | --- |
| A2029 | 8.65 | $7.04_{-0.19}^{+0.20}$ | $12.1\pm2.5$ |
| A2319 | 7.68 | $8.74_{-0.12}^{+0.11}$ |  |

The Planck proxy exceeds the X-COP mass for Abell 2319 and falls below it for Abell 2029. The proxy applies a pressure-to-mass relation calibrated on hydrostatic masses. Its printed errors describe the catalogue extraction. The hydrostatic and Planck estimates share some Planck data. [Second Planck SZ Catalogue, Sec. 7 and catalogue definitions](https://arxiv.org/abs/1502.01598v1)

Herbonnet et al. also integrated the tangential shear around Abell 2029 and deprojected it using an NFW model. The central estimate is $10.8\times10^{14}\,M_\odot$ inside 1.52 Mpc. At that same radius the published X-COP profile gives $9.21\times10^{14}\,M_\odot$. Their ratio is 0.85. The lensing mass alone spans $(8.5,12.7)\times10^{14}\,M_\odot$ over its quoted uncertainty. The frozen CFHT table supplies a match for Abell 2029. Its coverage leaves the Abell 2319 entry empty. [Herbonnet et al., Sec. 5.2 and Table A2 of the pinned preprint](https://arxiv.org/abs/1912.04414v1)

## Step 6. Fit with the central Planck bins masked

The Planck beam smears the smallest radii. Ghirardini et al. drop the first three SZ bins. Repeat that cut and the best pressure scale factor moves from 0.756 to 0.888 for Abell 2029 and from 0.922 to 1.096 for Abell 2319. Fixing the scale to one on these same outer bins raises the weighted residual score from 60.9 to 64.4, and from 198.4 to 206.2, respectively. The fitted factor depends on the radial cut. [Ghirardini et al., Sec. 2.5](https://arxiv.org/abs/1805.00042v2)

## Step 7. Rerun the simulated survey

cluster\_count\_selection.run builds a survey with true $\sigma_8=0.81$ and true $1-b=0.8$: Tinker mass function, Planck's $Y$-$M$ relation, lognormal scatter 0.173, noise growing with angular size, detection at $q>6$, 65 percent of the sky, ten redshift bins from 0 to 1.

**Table 5.3** Checks on the simulated survey.

| Check | Result |
| --- | --- |
| analytic detections | 481.9 |
| mean of 200 Monte Carlo surveys | 483.1, standard deviation 19.7 |
| difference in standard errors | 0.86 |
| detections predicted at $\sigma_8=0.81$ if $1-b$ were 1 | 1255 |

The Monte Carlo check matters because it draws individual clusters, scatters them and applies the cut, a route independent of the analytic integral. Then the script solves for the $\sigma_8$ that matches the expected total for each assumed $1-b$: 0.916 at 0.6, 0.810 at 0.8, 0.739 at 1.0.

## Failure cases kept on purpose

- Abell 2029's pressure fit reaches the outer-slope bound. Abell 2319's fitted scale crosses unity after masking. A single temperature or pressure calibration cannot explain those checks on its own.
- The script ignores covariance matrices and fits smooth forms, while the published masses come from forward-modelling. The fit tests whether the same inputs yield a nearby answer.
- The published rows are an exercise in matching definitions and apertures. Estimating one population correction requires a sample and its selection model.
- The toy survey's noise model and sky are simplified and its count is tuned to be similar to Planck's 439. It fits only the total count, so $\sigma_8$ and $1-b$ are completely degenerate.

## A checklist for the next calibration paper

1. Which mass does the paper call "true", and which mass calibrated the scaling relation?
2. Are the reported masses thermal-only hydrostatic masses, or corrected for non-thermal pressure?
3. Is $Y$ spherical or cylindrical, and inside which radius?
4. Is the scatter in the observable modelled together with the selection?
5. Are calibration and cosmology fitted in separate stages, and how does the uncertainty of the first enter the second?

To check what the Lab shows against these numbers, open [the cluster mass Lab](https://sandboxphysics.com/labs/galaxy-cluster-mass-calibration/).

## Try it in the Lab

[Weighing a galaxy cluster three ways](https://sandboxphysics.com/labs/galaxy-cluster-mass-calibration/): Match the Lab's X-ray ratio to the A2029 and A2319 numbers you computed.

## Sources

1. [Universal thermodynamic properties of the intracluster medium in the X-COP sample](https://arxiv.org/abs/1805.00042v2)
2. [Hydrostatic mass profiles in X-COP galaxy clusters](https://arxiv.org/abs/1805.00035v3)
3. [Non-thermal pressure support in X-COP galaxy clusters](https://arxiv.org/abs/1805.00034v2)
4. [Chandra sample of nearby relaxed galaxy clusters, Eq. 3](https://arxiv.org/abs/astro-ph/0507092v1)
5. [The universal galaxy cluster pressure profile from REXCESS, Eq. 12](https://arxiv.org/abs/0910.1234v1)
6. [Planck 2015 results XXIV, Sec. 1 and Eq. 7](https://arxiv.org/abs/1502.01597v3)
7. [Second Planck SZ Catalogue, Sec. 7 and catalogue definitions](https://arxiv.org/abs/1502.01598v1)
8. [Herbonnet et al., Sec. 5.2 and Table A2 of the pinned preprint](https://arxiv.org/abs/1912.04414v1)

## Keep reading

Weighing galaxy clusters with X-rays, SZ and lensing · Reading path

### From three scales to cluster counts

1. [Article **Why X-rays, the SZ effect and lensing weigh a galaxy cluster differently**](https://sandboxphysics.com/stories/cluster-mass-calibration/three-ways-to-weigh-a-cluster/)
2. [Article **How hot gas weighs a galaxy cluster in hydrostatic equilibrium**](https://sandboxphysics.com/stories/cluster-mass-calibration/hydrostatic-mass-from-x-rays/)
3. [Article **A first computable cluster model with SZ Compton y and lensing shear**](https://sandboxphysics.com/stories/cluster-mass-calibration/sz-pressure-and-lensing-shear/)
4. [Article **How a hydrostatic mass bias shifts cosmology from cluster counts**](https://sandboxphysics.com/stories/cluster-mass-calibration/mass-bias-and-cluster-counts/)
5. [You are here **Recompute X-COP hydrostatic masses and a toy SZ cluster survey**](https://sandboxphysics.com/stories/cluster-mass-calibration/recompute-xcop-hydrostatic-masses/)
6. [Article **How to read the Planck 2015 SZ cluster counts and the mass bias**](https://sandboxphysics.com/stories/cluster-mass-calibration/reading-the-planck-cluster-count-mass-bias/)
