Skip to main content

A GRB light-curve analysis package.

Project description

JOSS Travis Badge CodeCov - Coverage Status Documentation Status pypi version astropy

PyGRB logo

A gamma-ray burst (GRB) light-curve analysis package.

Introduction

PyGRB is a package to download gamma-ray burst (GRB) .FITS files from the relevant data archives (eg. NASA HEARSAC). At the moment only BATSE data can be downloaded and analysed with the software, although with only slight tweaks GRBs from other satellites can be easily analysed. The code is then able to create light-curves from either pre-binned data or time-tagged photon-event data. Light-curves may then be fitted with with pulse models, for further analysis. Model fitting is done with nested sampling, powered by Bilby, and Dynesty and/or Nestle.

Installation

The PyGRB repository maybe be installed manually through cloning the repository

$ git clone https://github.com/JamesPaynter/PyGRB
$ cd PyGRB
$ pip install -r requirements.txt
$ pip install .

or by downloading the compiled version from PyPI

$ pip install pygrb

Installation of PyGRB and its dependencies should take no longer than a couple of minutes.

Then import PyGRB through import PyGRB.

Pulse types

Description of GRB pulse phenomenology.

FRED eqn: $I(t) = A \exp{ - \xi \left( \frac{t - \Delta}{\tau} + \frac{\tau}{t-\Delta} \right)}$

See documentation for more

BATSE trigger 7475

Usage

Say we would like to fit a GRB light-curve such as the above, and determine its pulse parameters. First we must load the relevant modules.

from PyGRB.main.fitpulse import PulseFitter
from PyGRB.backend.makemodels import create_model_from_key

The PulseFitter class is the main workhorse of the software.

GRB = PulseFitter(7475, times = (-2, 60),
          datatype = 'discsc', nSamples = 200, sampler = 'nestle',
          priors_pulse_start = -5, priors_pulse_end = 30)

The first argument specifies the BATSE trigger to be analysed, in this case trigger 7475. Times can either be specified as 'T90', 'full', or a tuple of start and end times. In the case of trigger 7475, most of the action happens over about (-2, 60), so we choose this interval for our times. The nSamples parameter determines how many live points the nested sampler is initiated with. The sampler parameter is used to choose between samplers. The priors_pulse_start and priors_pulse_end parameters are used to set the (uniform) interval over which the program will allow the pulse start times. The datatype parameter specifies which kind of data we would like to download and analyse. Typically 'discsc' is the most useful. 'tte' is better for short GRBs. The data will be downloaded and stored in data/.

create_model_from_key allows us to specify pulse models based on a simple key. The simple pulse type, a fast-rise exponential-decay (FRED) pulse, is utilised by

key = 'F'
model = create_model_from_key(key)

Finally, we run the model through the sampler

GRB.main_multi_channel(channels = [0, 1, 2, 3], model = model)

The data products are stored in products/.

We should be left with a light-curve that looks like this:

BATSE trigger 7475

See documentation for more

Under the Hood

a GRB light-curve fit animation

There is a typo in this animation, the two fractions should take the same sign (+ve). The -2 is an amplitude normalisation factor.

See documentation for more

Contribute

‘PyGRB’ is an open-source software package freely available under the BSD 3-Clause License. Users may request new features by opening a GitHub Issue, or may contribute their own additions and improvements via a pull request. Similarly, if you run into problems while using PyGRB, or require technical support, do not hesitate to request support through a GitHub Issue. If you use PyGRB in your work and would like to further collaborate on GRBs or gravitational lensing, I would be more than willing to discuss it over email or GitHub Issue.

An incomplete list of possible improvements:

  • Include support for uneven bin sizes and data gaps.

  • Include compatibility with other GRB catalogues that are publicly available.

  • Include capability to download and plot GRB spectra in addition to light-curves.

  • Increase coverage to 100%

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

PyGRB-1.0.2.tar.gz (757.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyGRB-1.0.2-py3-none-any.whl (764.2 kB view details)

Uploaded Python 3

File details

Details for the file PyGRB-1.0.2.tar.gz.

File metadata

  • Download URL: PyGRB-1.0.2.tar.gz
  • Upload date:
  • Size: 757.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for PyGRB-1.0.2.tar.gz
Algorithm Hash digest
SHA256 746dc58ac3e718128fed6a857d643b01b724a05dd134951e47be8ccbfe269e95
MD5 4ac0e9025b19f0a88242234285f02c83
BLAKE2b-256 00fa70b5bfd12db4b1db5eb88b6761836da4ce1094a6ec98a287ef8a52241a5c

See more details on using hashes here.

File details

Details for the file PyGRB-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: PyGRB-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 764.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for PyGRB-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58a5c78ab36fd504805c8293ec7fa081bb3cde9dc926e7c9c3dca2ca86c0fb46
MD5 70216b502d8211258ffbeb72f2d2d3e3
BLAKE2b-256 386973cfbfbd85549d4ce856c73c528e693fdc6311c75ee04064b781036afdd3

See more details on using hashes here.

Supported by

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