
Company News
Meet the Socket Team at RSAC and BSidesSF 2026
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.
afterglowpy
Advanced tools
A Python 3 module to calculate GRB afterglow light curves and spectra. Details of the methods can be found in Ryan et al 2020 and Ryan et al 2024. Builds on van Eerten & MacFadyen 2010 and van Eerten 2018. This code is under active development.
Documentation available at https://afterglowpy.readthedocs.io/
If you use this code in a publication, please refer to the package by name and cite "Ryan, G., van Eerten, H., Piro, L. and Troja, E., Astrophysical Journal 896, 166 (2020)" ADS link. Upgrades including centroid motion, size, and the deep Newtonian phase are presented in "Ryan, G., van Eerten, H., Troja, E., Piro, L., O'Connor, B., and Ricci, R., Astrophysical Journal 975, 131 (2024)" ADS link.
This work is funded in part by the European Union’s Horizon 2020 Programme under the AHEAD2020 project (grant agreement n. 871158).
afterglowpy computes synchrotron emission from the forward shock of a relativistic blast wave. It includes:
It has limited support (these should be considered experimental) for:
It does not include (yet):
afterglowpy has been calibrated to the BoxFit code (van Eerten, van der Horst, & Macfadyen 2011, available at the Afterglow Library) and produces similar light curves for top hat jets (within 50% when same parameters are used) both on- and off-axis. Its jet models by default do not include an initial coasting phase, which may effect predictions for early observations.
ignoreBounds Boolean keyword argument to ignore built-in bounds checking on parameters.moment keyword.specType=grb.jet.DeepNewtonianafterglowpy is available via pip:
$ pip install afterglowpy
afterglowpy is compatible with Numpy v1 and v2, Python 3.8+, and runs on MacOS, Linux, and Windows.
If you are working on a local copy of this repo and would like to install from source, you can the run the following from the top level directory of the project.
$ pip install -e .
In your python code, import the library with import afterglowpy as grb.
The main function of interest isgrb.fluxDensity(t, nu, **kwargs). See examples/plotLightCurve.py for a simple example.
For jet-like afterglows there are up to 13 required keyword arguments:
jetType an integer code setting the jet structure. It can be grb.jet.TopHat, grb.jet.Gaussian, grb.jet.PowerLawCore, grb.jet.GaussianCore, grb.jet.Spherical, or grb.jet.PowerLaw.specType an integer code specifying flags for the emissivity function and spectrum. Can be grb.jet.SimpleSpec (basic spectrum with νm and νc), grb.jet.DeepNewtonian, grb.jet.EpsEBar to interpret epsilon_e as ε̅e = εe(p-2)/(p-1), grb.jet.ICCooling (simple inverse Compton effects on the cooling frequency, experimental). Multiple options can be combined with the | operator.thetaObs viewing angle in radiansE0 on-axis isotropic equivalent energy in ergthetaCore half-width of the jet core in radians (jetType specific)thetaWing "wing" truncation angle of the jet, in radiansb power for power-law structure, θ-bn0 Number density of ISM, in cm-3p Electron distribution power-law index (p>2)epsilon_e Thermal energy fraction in electronsepsilon_B Thermal energy fraction in magnetic fieldxi_N Fraction of electrons that get acceleratedd_L Luminosity distance in cmOptional keyword arguments for all models are:
z redshift (defaults to 0)spread boolean (defaults to True), whether to allow the jet to spread.counterjet boolean (defaults to False), whether to include the counterjetmoment array (integer dtype, same shape as t and nu) which sky moment to compute.ignoreBounds boolean (defaults to False), whether to ignore the built in paramter bounds checking.L0 Fiducial luminosity for energy injection, in erg/s, default 0.0.q Temporal power-law index for energy injection, default 0.0.ts Fiducial time-scale for energy injection, in seconds, default 0.tRes time resolution of shock-evolution scheme, number of sample points per decade in timelatRes latitudinal resolution for structured jets, number of shells per thetaCrtol target relative tolerance of flux integrationFAQs
GRB Afterglow Models
We found that afterglowpy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.

Research
/Security News
OpenVSX releases of Aqua Trivy 1.8.12 and 1.8.13 contained injected natural-language prompts that abuse local AI coding agents for system inspection and potential data exfiltration.