Skip to main content

A neural network emulator for BOXFIT

Project description

DeepGlow: Neural Network emulation of BOXFIT

Python CI Python CD License PyPI GitHub issues GitHub stars

DeepGlow is a feed-forward neural network trained to emulate BOXFIT simulation data of gamma-ray burst (GRB) afterglows. This package provides an easy interface to generate GRB afterglow spectra and light curves mimicking those generated through BOXFIT with high accuracy. Details are provided in the published paper: doi.org/10.1017/pasa.2023.32.

This repository also contains the code used to generate the training data and to train the neural networks.

Installation

Installation is straightforward via pip:

pip install DeepGlow

DeepGlow specifically requires numpy, TensorFlow 2.x.x, and the importlib.resources package. For testing, pytest is needed as well.

Use

To generate light curves or spectra, create an instance of the Emulator class specifying the progenitor environment (either ism or wind):

from DeepGlow import Emulator

model = Emulator(simtype='ism')

The flux function of the Emulator class returns the flux values in mJy. It takes the three arguments params, t_obs and nu_obs corresponding to an array of the GRB afterglow parameters, observing times in seconds and observing frequencies in Hz. Each observing time value in the t_obs array must correspond to an observing frequency value in the nu_obs array. The afterglow parameters need to be specified in the following order in the params array:

  • $z$ : redshift.
  • $\log_{10} d_{L,28}$ : luminosity distance (log10 of 10^28 cm).
  • $\log_{10} E_\mathrm{K,iso,53}$ : isotropic-equivalent energy (log10 of 10^53 erg).
  • $\log_{10} n_\mathrm{ref}$ : circumburst medium density (log10 of cm^-3).
  • $\theta_0$ : jet half-opening angle (rad).
  • $\theta_\mathrm{obs} / \theta_0$ : off-axis observer angle as a fraction of the jet half-opening angle.
  • $p$ : electron spectral index.
  • $\log_{10} \bar{\epsilon}_e \equiv \frac{p-2}{p-1} \epsilon_e$ : energy fraction in accelerated electrons (in log10), with factor of $(p - 2) / (p - 1)$ absorbed.
  • $\log_{10} \epsilon_B$ : energy fraction in magnetic field (in log10).
  • $\log_{10} \xi_N$ : fraction of electrons accelerated (in log10).

For example:

import numpy as np

GRB_params = np.array([0,-1,0,0,0.1,0.1,2.2,-2,-2,0])
observing_times=np.array([1e5,1e6,1e7])
observing_frequencies = np.array([1e9,1e12,1e15])
flux_values = model.flux(params=GRB_params,t_obs=observing_times,nu_obs=observing_frequencies)
print(flux_values)
# [5.75068180e-01, 8.58790301e-01, 5.39014321e-05]

Training data

The training data generated with BOXFIT is provided through a Zenodo data package: https://zenodo.org/record/7472542

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DeepGlow-1.1.0.tar.gz (45.9 MB view hashes)

Uploaded Source

Built Distribution

DeepGlow-1.1.0-py3-none-any.whl (45.9 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page