Skip to main content
Sandbox Physics
Gamma-ray burst afterglows and off-axis jets

Fit top-hat and Gaussian jets to GW170817

Sandbox Physics ·

This guide fits two jet shapes to 42 real detections of the GW170817 afterglow. A Gaussian jet seen about 21∘21^\circ off its axis fits with χ2=53.7\chi^2=53.7. The best sharp-edged jet only reaches χ2=204\chi^2=204, because it cannot rise slowly enough. Holding the viewing angle anywhere from 15∘15^\circ to 35∘35^\circ and refitting the rest changes χ2\chi^2 by at most 4, while the ratio of viewing angle to core width stays between 6.71 and 6.82. The Python scripts below let you check the fit and follow up with a second test on withheld data.

Read off-axis structured jets and GW170817 first. The dots are telescope measurements. Our thin-shell model draws the curves.

Get the files

Extract the complete reproduction ZIP into an empty folder. The original fit also runs with these individual files:

Then run:

python3 reproduce.py

No packages are needed. The script prints every fit, compares each number with the saved outputs and exits with status 0 when all agree to within 0.01 or 0.2 percent, whichever is larger. The replay passed in Python 3.12.12. A full run takes a few minutes. Use the separate output files for modified runs.

The frozen slice

The observations come from the uniform table of Makhathini and collaborators, copied from the LaTeX source of the arXiv version. The slice has 22 VLA detections and one upper limit at 3 GHz, nine Hubble F606W detections and two optical upper limits, and eleven 1 keV detections with one upper limit from Chandra or XMM-Newton. That gives 42 detections and four upper limits. The panchromatic afterglow of GW170817, Sec. 2 and data table

The file records the source tarball checksum and its own checksum is in provenance.json. Asymmetric X-ray errors are kept: the misfit uses the upper error when the model lies above a point and the lower error when it lies below. Upper limits stay out of χ2\chi^2; the script checks that each best fit lies below every one of them.

The model

afterglow_model.py treats each patch of the jet as a piece of a spherical blast wave carrying the local energy E(θ)E(\theta), as in the course chapters:

  1. The Lorentz factor follows the energy equation of Huang, Dai and Lu, with Γ0=300\Gamma_0=300 and no sideways spreading.
  2. Arrival times use τ=tlab−R/c\tau=t_{\rm lab}-R/c plus the path difference R(1−cos⁡χ)/cR(1-\cos\chi)/c for every patch. The angle χ\chi is measured from the observer’s line of sight.
  3. Each patch radiates the Sari–Piran–Narayan broken power law, Doppler shifted by δ\delta and scaled by δ3\delta^3. Self-absorption is left out.
  4. The sky is cut into 40 rings and 16 azimuth samples per jet, and both jets are summed.

The distance is 40 Mpc and the redshift is neglected. The Lab uses the same physics in TypeScript on a finer grid, 56 rings and 36 azimuth cells.

Three numbers are fixed: p=2.168p=2.168 from the measured spectral slope, ϵe=0.1\epsilon_e=0.1 and ϵB=10−4\epsilon_B=10^{-4}. Four are fitted: viewing angle, core width, log⁡10E0\log_{10}E_0 and log⁡10n\log_{10}n.

What the fits give

Table 4.1 Best fits to the 42 detections. Slopes are the model's 3 GHz slope between days 15 and 60.
Jetθobs\theta_{\rm obs}θc\theta_clog⁡10E0\log_{10}E_0log⁡10n\log_{10}nθobs/θc\theta_{\rm obs}/\theta_cχ2\chi^2Rise slope
Gaussian20.94∘20.94^\circ3.11∘3.11^\circ52.29−2.98-2.986.7353.71.10
Top-hat20.07∘20.07^\circ8.14∘8.14^\circ51.93−3.45-3.452.47204.22.93

The Gaussian fit gives χ2\chi^2 per detection of 1.28. Both fits respect every upper limit.

The top-hat fails for the reason the closure relations predict. With no energy outside the core, the only way to see light at day 15 is a wide core seen not far from its edge. Even then the model rises as t2.9t^{2.9}, against the measured t0.86t^{0.86}, and its misfit is almost four times the Gaussian one.

Hold out the optical and X-ray data

Run the command below. It fits just the 22 radio detections and then predicts the optical and X-ray amplitudes with those parameters held fixed. This check uses the electron index inferred from the original broadband study. It tests how the radio-calibrated temporal models transfer across bands at that spectral slope.

python3 held_bands.py --output held-bands.json
Table 4.2 Chi-square per detection after fitting the radio data.
JetRadio fitHeld Hubble F606WHeld 1 keV
Gaussian1.371.171.36
Top-hat6.561.764.51

Each value is chi-square per detection. The largest separation between the predictions and the held data is in the X-ray comparison. After day 200 the original slice still has nine radio and five X-ray detections. The JSON gives the predicted flux and the signed residual for each measurement. Its upper limits are compared separately.

The README gives the download address for the pinned paper archive. The second command below checks all 46 local rows against that archive. The archive also contains an independent arrival-time calculation, so the sky geometry can be checked without using the fit.

python3 verify_observations.py --source-archive makhathini-v3.tar.gz --output source-check.json

The degeneracy scan

reproduce.py then fixes the viewing angle at five values and refits the other three parameters.

Table 4.3 Gaussian fits with the viewing angle held fixed.
θobs\theta_{\rm obs}θc\theta_clog⁡10E0\log_{10}E_0log⁡10n\log_{10}nθobs/θc\theta_{\rm obs}/\theta_cχ2\chi^2
15∘15^\circ2.24∘2.24^\circ52.57−3.82-3.826.7153.9
20∘20^\circ2.97∘2.97^\circ52.33−3.10-3.106.7353.6
25∘25^\circ3.70∘3.70^\circ52.15−2.53-2.536.7654.1
30∘30^\circ4.42∘4.42^\circ52.00−2.07-2.076.7955.4
35∘35^\circ5.14∘5.14^\circ51.87−1.68-1.686.8257.6

The ratio barely moves. The density moves by two orders of magnitude to keep the peak time fixed, as the break-time formula tb∝(E0/n)1/3(θobs+1.24θc)8/3t_{\rm b}\propto(E_0/n)^{1/3}(\theta_{\rm obs}+1.24\theta_c)^{8/3} requires. Allowing ϵe\epsilon_e and ϵB\epsilon_B to vary would introduce two more ways to trade off parameters.

Ryan and collaborators found the same pattern with a different model and dataset. Their Gaussian fit constrained θobs/θc=6.12±0.18\theta_{\rm obs}/\theta_c=6.12\pm0.18 much better than either angle, and the angle itself only after adding the gravitational-wave inclination as a prior. Gamma-ray burst afterglows in the multi-messenger era, Sec. 5

What the angle ratio tells you

The shape of the valley reflects the assumed independent angular patches and fixed microphysics. Adding sideways spreading or refreshed shocks changes the light-curve model. A gravitational-wave inclination likelihood and the radio image's proper motion add independent information. Computing a credible interval needs those choices and a stated prior.

This fit gives a ratio near 6.7. Ryan's earlier model fit gives 6.12, about nine percent lower relative to our value. The approximation from the rise gives 5.6, about sixteen percent lower. The three estimates use different models or subsets of the data.

Try it yourself

  1. Edit FIXED in fit_jets.py to set ϵB=10−3\epsilon_B=10^{-3} and rerun with --write. Predict which fitted parameter moves most.
  2. Remove the X-ray rows from the slice and refit. Does the top-hat do better when only radio and optical points remain?
  3. Set the sliders of the off-axis afterglow Lab to the best Gaussian fit and check that its curves pass through the dots in all three bands. The Lab's misfit readout uses the 22 radio detections. The tutorial's fit uses all 42 detections and reports χ2\chi^2.

Sources

  1. The panchromatic afterglow of GW170817, Sec. 2 and data table
  2. Gamma-ray burst afterglows in the multi-messenger era, Sec. 5

Keep reading

What this page links to directly

See this series on the content map →

Gamma-ray burst afterglows and off-axis jets · Reading path

From a beamed blast wave to GW170817

  1. ArticleWhy the GW170817 afterglow kept brightening for months
  2. ArticleBeaming and arrival times of a slowing blast wave
  3. ArticleThe synchrotron spectrum and the jet break
  4. ArticleOff-axis structured jets and GW170817
  5. You are hereFit top-hat and Gaussian jets to GW170817
  6. ArticleHow to read Ryan et al. 2020 on structured-jet afterglows
Something broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy