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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file DeepGlow-1.1.0.tar.gz.

File metadata

  • Download URL: DeepGlow-1.1.0.tar.gz
  • Upload date:
  • Size: 45.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for DeepGlow-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6986d0e2079afb2638bdebb9e41537bc94ae29db00df3f1bafc4706eb5b16480
MD5 fddf31bf0a0dd0a6f011636ddc1b5339
BLAKE2b-256 5acd1a3157b6629e3cf5cfb96a389365412cd79c77797c299a1b25b55bfb6292

See more details on using hashes here.

File details

Details for the file DeepGlow-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: DeepGlow-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for DeepGlow-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 053dc17f27fe550e0fe87e5b25cecfa93bf50809756a46bc56817f4e537b2fe8
MD5 8bbbd3ed7ae3d077c19fcdd53af68461
BLAKE2b-256 651fea4e242fa428286bbedd93e1ecf89cabc2e12f261379989c492249afef8a

See more details on using hashes here.

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