---
title: "Recompute the localized-burst baryon census"
description: "Split five localized bursts into Milky Way, cosmic and host parts, refit the baryon density with saved scripts, and see six ways the result breaks."
canonical_url: "https://sandboxphysics.com/stories/frb-baryon-census/recompute-the-localized-frb-census/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/frb-baryon-census/recompute-the-localized-frb-census/"
last_modified: "2026-11-14"
---

[Fast radio bursts and the cosmic baryon census](https://sandboxphysics.com/stories/frb-baryon-census/)

# Recompute the localized-burst baryon census

Sandbox Physics · 2026-11-14

This guide refits the cosmic baryon density from the five gold-standard ASKAP bursts of Macquart and colleagues with saved scripts. It splits each burst into Milky Way, cosmic and host parts, rebuilds the four-parameter likelihood on a grid, and gets $\Omega_{\mathrm b}h_{70}=0.0505$ with a 68 percent interval from $0.0399$ to $0.0623$. The published values are $0.051^{+0.014}_{-0.015}$ from the frequentist analysis and $0.056$ from the Markov-chain analysis. Two independent checks test the scripts, and six recorded mistakes show how the result breaks.

Read [Adding up electrons across an expanding universe](https://sandboxphysics.com/stories/frb-baryon-census/adding-up-electrons-across-the-universe/) and [Why every sightline gives a different dispersion](https://sandboxphysics.com/stories/frb-baryon-census/why-every-sightline-differs/) first; they derive the two ingredients used here. The paper is [Macquart et al., 2020, arXiv version 1](https://arxiv.org/abs/2005.13161v1), published in Nature 581, 391.

## Get the materials and run them

Download the [scripts, inputs and saved outputs](https://sandboxphysics.com/stories/frb-baryon-census/materials/frb-baryon-census.zip) and extract the archive. It contains six Python files, the three saved JSON files and a short README. The scripts use only the Python standard library. The saved run used Python 3.9.6 and took 113 seconds.

```
cd frb-baryon-census/scripts
python3 reproduce_benchmarks.py ../my-run
```

The run writes inputs.json, outputs.json and failure-cases.json into the folder you name. A rerun reproduces the saved files byte for byte. The same files are served as [inputs](https://sandboxphysics.com/stories/frb-baryon-census/materials/inputs.json), [outputs](https://sandboxphysics.com/stories/frb-baryon-census/materials/outputs.json) and [failure cases](https://sandboxphysics.com/stories/frb-baryon-census/materials/failure-cases.json). Run from the scripts folder, because the main script imports its five siblings from there.

## Fix the inputs and units

Dispersion measures are in $\mathrm{pc\,cm^{-3}}$, distances in comoving megaparsecs and masses in solar masses. The fixed inputs are:

**Table 5.1** Fixed inputs of the saved run.

| Quantity | Value | Source |
| --- | --- | --- |
| $H_0$, $\Omega_{\mathrm b}$, $\Omega_\Lambda$ | $67.74$, $0.0486$, $0.691$ | Planck 2015, as in Macquart Fig. 2 |
| Helium mass fraction $Y$ | 0.25 | Macquart eq. 2 |
| Diffuse fraction $f_{\mathrm d}$ | 0.85, constant | teaching choice; Macquart use $f_{\mathrm d}(z)$ |
| Milky Way disc and halo | 30 and 50 | Macquart main text |
| Bursts and redshifts | six from Table 1, five gold | Macquart Table 1 |
| Grid in $\Omega_{\mathrm b}h_{70}$ | 0.01 to 0.11, step 0.0025 | our choice |
| Grid in $F$ | 0.05 to 0.5, ten values | our choice |
| Host median $e^{\mu}$ and width $\sigma_{\mathrm{host}}$ | 20 to 330 and 0.2 to 1.5 | our choice |

Macquart and colleagues scanned $e^{\mu}$ from 20 to 200 and $\sigma_{\mathrm{host}}$ from 0.2 to 2.0. Our grid is a little different, so small differences in the interval are expected.

## Split each burst into its parts

Subtract the Milky Way's 80 to get $\mathrm{DM}'$, compare with the mean cosmic value at the host redshift, and the remainder is what the host must supply, first as seen from Earth and then in the host's own frame.

**Table 5.2** The six bursts split into parts.

| Burst | $z$ | $\mathrm{DM}'$ | Mean cosmic | Host, observed | Host, rest frame |
| --- | --- | --- | --- | --- | --- |
| FRB 180924 | 0.3214 | 281.42 | 282.59 | $-1.17$ | $-1.55$ |
| FRB 181112 | 0.4755 | 509.27 | 425.84 | 83.43 | 123.1 |
| FRB 190102 | 0.291 | 283.6 | 254.73 | 28.87 | 37.27 |
| FRB 190608 | 0.1178 | 258.7 | 99.91 | 158.79 | 177.5 |
| FRB 190611 | 0.378 | 241.4 | 334.87 | $-93.47$ | $-128.81$ |
| FRB 190711 | 0.522 | 513.1 | 469.5 | 43.6 | 66.36 |

A negative host term is not a mistake. It means the sightline has less cosmic gas than average. FRB 190611 is the one burst whose host Macquart and colleagues call tentative, and it is left out of the gold sample.

```
from frb_cosmology import dispersion_constant, mean_cosmic_dispersion

print(round(dispersion_constant(0.85), 2), round(mean_cosmic_dispersion(0.5), 2))
```

This prints 824.34 and 448.82: the constant $K$ and the mean cosmic dispersion at $z=0.5$.

## Build the likelihood

For each burst the probability of its $\mathrm{DM}'$ is the convolution of the cosmic and host distributions, eq. 7 of the paper:

$$
P_i(\mathrm{DM}'_i\mid z_i)=\int_0^{\mathrm{DM}'_i}p_{\mathrm{host}}(\mathrm{DM}_{\mathrm{host}}\mid\mu,\sigma_{\mathrm{host}})\,p_{\mathrm{cosmic}}(\mathrm{DM}'_i-\mathrm{DM}_{\mathrm{host}}\mid z_i)\,\mathrm d\mathrm{DM}_{\mathrm{host}} .
$$

The host term is the log-normal of eq. 3, with median $e^{\mu}$ in the host's rest frame, transformed to the observer by the factor $1/(1+z)$ as the Methods text after eq. 3 describes. The cosmic term is eq. 4 with $\Delta=\mathrm{DM}_{\mathrm{cosmic}}/\langle\mathrm{DM}_{\mathrm{cosmic}}\rangle$, $\sigma_{\mathrm{DM}}=Fz^{-1/2}$, and $\langle\mathrm{DM}_{\mathrm{cosmic}}\rangle$ proportional to $\Omega_{\mathrm b}h_{70}$. The scripts solve for $C_0$ by bisection so that the mean of $\Delta$ is 1 on $0.05\le\Delta\le10$. The total likelihood is the product over bursts, eq. 5. Priors are flat on the grid, and $F$, $\mu$ and $\sigma_{\mathrm{host}}$ are summed out.

## What the recomputation gives

**Table 5.3** Baryon density from the gold sample.

| Analysis | $\Omega_{\mathrm b}h_{70}$ | 68 percent interval |
| --- | --- | --- |
| This grid, flat priors | 0.0505 | 0.0399 to 0.0623 |
| Macquart, frequentist (main text) | 0.051 | 0.036 to 0.065 |
| Macquart, Markov chain (Ext. Data Table 2) | 0.056 | 0.046 to 0.066 |
| Planck 2015 | 0.04703 | not applicable |

The 95 percent interval of the grid runs from $0.0271$ to $0.0734$. The recomputation lands on the published frequentist value. The Markov-chain value is higher, which is consistent with its different priors and with $f_{\mathrm d}(z)$ in place of our constant.

## Two independent checks

The first check never uses the likelihood. It recomputes the mean relation with a separately written Gauss–Legendre rule, compares with Simpson's rule, and tests the two closed-form universes of the earlier chapter. All agree to about one part in $10^{15}$.

The second is a host injection. The scripts draw 40 synthetic bursts with known truth, $\Omega_{\mathrm b}h_{70}=0.049$, $F=0.2$, host median 100 and width 0.5, then fit them with the same grid. Over 20 such samples the mean recovered value is $0.04956$, a bias of $+0.00056$, and the true value lies inside the 68 percent interval in 18 of 20. The likelihood recovers what was put in.

## Six ways to get it wrong

The saved failure-cases.json records six mistakes and their size.

1. Fitting all six bursts, including FRB 190611, gives $0.0394$ with a 68 percent interval from $0.0277$ to $0.0502$. One burst with an uncertain host pulls the answer down by a fifth.
2. Setting the Milky Way halo to zero instead of 50 gives $0.0562$: the 50 is attributed to cosmic gas.
3. Counting one free electron per proton mass, as if there were no helium, gives $0.0442$, because each baryon then supplies too many electrons.
4. Reading the observed residual as a rest-frame host value underestimates every host. For FRB 181112 the observed residual is $83.4$, but the rest-frame value is $123.1$.
5. Reading dispersion as distance puts FRB 190608 at $z=0.295$ instead of $0.118$, and FRB 190611 at $0.276$ instead of $0.378$. A dispersion measure is not a unique distance.
6. Keeping only synthetic bursts with $\mathrm{DM}'<600$, but fitting as if nothing were dropped, keeps about 23 of 40, biases the result by $-0.0036$ and leaves the truth inside the 68 percent interval in only 9 of 20 samples. A survey that misses high-dispersion bursts underestimates the baryon density.

## What this does and does not establish

The recomputation shows that the published number follows from the published data, equations and Milky Way terms, and that the likelihood recovers injected values. It does not test the Milky Way halo value, the host model or the choice of gold sample; each of those moves the answer by about its error bar, as the failure cases show. Five bursts constrain the baryon density to between 20 and 30 percent. The newer and larger sample is discussed in [Reading the FRB baryon census papers](https://sandboxphysics.com/stories/frb-baryon-census/reading-the-frb-baryon-census/), and the halo-gas model behind $F$ is described by [Prochaska and Zheng, 2019, Section 7.1](https://arxiv.org/abs/1901.11051v1).

## [Try it in the FRB baryon-census Lab](https://sandboxphysics.com/labs/frb-baryon-census/)

Choose A dense host fakes distance and compare the two redshift readouts.

## Sources

1. [Macquart et al., 2020, arXiv version 1](https://arxiv.org/abs/2005.13161v1)
2. [Prochaska and Zheng, 2019, Section 7.1](https://arxiv.org/abs/1901.11051v1)

## Keep reading

Fast radio bursts and the cosmic baryon census · Reading path

### From one delayed pulse to the missing baryons

1. [Article **How do fast radio bursts count the ordinary matter between galaxies?**](https://sandboxphysics.com/stories/frb-baryon-census/late-radio-waves-count-hidden-electrons/)
2. [Article **How free electrons delay a radio burst**](https://sandboxphysics.com/stories/frb-baryon-census/how-plasma-delays-a-radio-burst/)
3. [Article **Adding up electrons across an expanding universe**](https://sandboxphysics.com/stories/frb-baryon-census/adding-up-electrons-across-the-universe/)
4. [Article **Why every sightline gives a different dispersion**](https://sandboxphysics.com/stories/frb-baryon-census/why-every-sightline-differs/)
5. [You are here **Recompute the localized-burst baryon census**](https://sandboxphysics.com/stories/frb-baryon-census/recompute-the-localized-frb-census/)
6. [Article **Reading the FRB baryon census papers**](https://sandboxphysics.com/stories/frb-baryon-census/reading-the-frb-baryon-census/)
