PyGRB

PyGRB: A pure Python gamma-ray burst analysis package. - Published in JOSS (2020)

https://github.com/jamespaynter/pygrb

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

astrophysics gamma-ray-astronomy gamma-ray-burst

Scientific Fields

Mathematics Computer Science - 63% confidence
Earth and Environmental Sciences Physical Sciences - 40% confidence
Engineering Computer Science - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

Gamma-ray burst analysis library

Basic Info
  • Host: GitHub
  • Owner: JamesPaynter
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Homepage: https://pygrb.readthedocs.io/
  • Size: 7.43 MB
Statistics
  • Stars: 31
  • Watchers: 2
  • Forks: 10
  • Open Issues: 0
  • Releases: 2
Topics
astrophysics gamma-ray-astronomy gamma-ray-burst
Created about 6 years ago · Last pushed about 5 years ago
Metadata Files
Readme License

README.rst

|JOSS| |DOI| |pypi| |version| |Travis| |Coverage| |Docs| |AstroPy|

.. image:: https://github.com/JamesPaynter/PyGRB/blob/master/docs/source/images/logo.png
    :align: center
    :alt: PyGRB logo

.. inclusion-marker-one-liner-start

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

.. inclusion-marker-one-liner-end



.. inclusion-marker-what-it-does-start

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
^^^^^^^^^^^^
*PyGRB* may be installed manually through cloning the repository

.. code-block:: console

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

or by downloading the compiled version from `PyPI `__

.. code-block:: console

  $ pip install pygrb


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

Then import *PyGRB* through ``import PyGRB``.

.. inclusion-marker-what-it-does-end


.. inclusion-marker-pulse-types-start

Pulse types
------------
Description of GRB pulse phenomenology.

.. image:: https://github.com/JamesPaynter/PyGRB/blob/master/docs/source/images/equations/FRED.gif
    :align: center
    :alt: FRED eqn: $I(t) = A \exp{ - \xi \left( \frac{t - \Delta}{\tau} + \frac{\tau}{t-\Delta} \right)}$


.. inclusion-marker-pulse-types-end

`See documentation for more `__



.. role:: python(code)
   :language: python

.. image:: https://github.com/JamesPaynter/PyGRB/blob/master/docs/source/images/BATSE_trigger_7475_rates_rates.png
    :align: center
    :alt: BATSE trigger 7475


Usage
------

.. inclusion-marker-usage-start

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.

.. code-block:: python

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


The :python:`PulseFitter` class is the main workhorse of the software.

.. code-block:: python

  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 :python:`'T90'`, :python:`'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 :python:`nSamples` parameter determines how many live points the nested sampler is initiated with.
The :python:`sampler` parameter is used to choose between samplers.
The :python:`priors_pulse_start` and :python:`priors_pulse_end` parameters are used to set the (uniform) interval over which the program will allow the pulse start times.
The :python:`datatype` parameter specifies which kind of data we would like to download and analyse.
Typically :python:`'discsc'` is the most useful.
:python:`'tte'` is better for short GRBs.
The data will be downloaded and stored in :code:`data/`.



:python:`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

.. code-block:: python

  key = 'F'
  model = create_model_from_key(key)


Finally, we run the model through the sampler

.. code-block:: python

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


The data products are stored in :code:`products/`.


.. inclusion-marker-usage-end


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

.. image:: https://github.com/JamesPaynter/PyGRB/blob/master/docs/source/images/B_7475__d_NL200__rates_F.png
    :align: center
    :alt: BATSE trigger 7475


`See documentation for more `__


Under the Hood
---------------


.. image:: https://github.com/JamesPaynter/PyGRB/blob/master/docs/source/images/pulse_fit_animation.gif
    :align: center
    :alt: 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.

  - `Swift BAT `__

  - `Fermi GBM `__

  - `Konus Wind `__

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

- Increase coverage to 100%



.. _GitHub Issue: https://github.com/JamesPaynter/PyGRB/issues

.. |AstroPy| image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
    :target: http://www.astropy.org/
    :alt: astropy

.. |Travis| image:: https://travis-ci.com/JamesPaynter/PyGRB.svg?branch=master
    :alt: Travis Badge
    :target: https://travis-ci.com/JamesPaynter/PyGRB

.. |Coverage| image:: https://codecov.io/gh/JamesPaynter/PyGRB/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/JamesPaynter/PyGRB
    :alt: CodeCov - Coverage Status

.. |Docs| image:: https://readthedocs.org/projects/pygrb/badge/?version=latest
    :target: https://pygrb.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |pypi| image:: https://badge.fury.io/py/PyGRB.svg
    :target: https://badge.fury.io/py/PyGRB

.. |version| image:: https://img.shields.io/pypi/pyversions/pygrb.svg
    :target: https://pypi.org/project/pygrb/

.. |JOSS| image:: https://joss.theoj.org/papers/8aff0347e6993ec23b060052a80aaaa0/status.svg
    :target: https://joss.theoj.org/papers/8aff0347e6993ec23b060052a80aaaa0
    
.. |DOI| image:: https://zenodo.org/badge/213533787.svg
   :target: https://zenodo.org/badge/latestdoi/213533787

Owner

  • Name: James Paynter
  • Login: JamesPaynter
  • Kind: user
  • Location: Melbourne
  • Company: The University of Melbourne

JOSS Publication

PyGRB: A pure Python gamma-ray burst analysis package.
Published
September 20, 2020
Volume 5, Issue 53, Page 2536
Authors
James R. Paynter ORCID
School of Physics, University of Melbourne, Parkville, Victoria, 3010, Australia
Editor
Juanjo Bazán ORCID
Tags
python astrophysics cosmology gamma-ray bursts gravitational lensing

GitHub Events

Total
  • Watch event: 2
  • Fork event: 2
Last Year
  • Watch event: 2
  • Fork event: 2

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 175
  • Total Committers: 2
  • Avg Commits per committer: 87.5
  • Development Distribution Score (DDS): 0.023
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
JamesPaynter j****r@s****u 171
Juanjo Bazán j****n@g****m 4
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 6
  • Total pull requests: 7
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 7 hours
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 4.67
  • Average comments per pull request: 0.14
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • zingale (4)
  • JohannesBuchner (1)
  • grburgess (1)
Pull Request Authors
  • JamesPaynter (3)
  • xuanxu (3)
  • MoritzThomasHuebner (1)
Top Labels
Issue Labels
documentation (2) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 21 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 8
  • Total maintainers: 1
pypi.org: pygrb

A GRB light-curve analysis package.

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 21 Last month
Rankings
Dependent packages count: 10.1%
Forks count: 12.5%
Stargazers count: 13.0%
Average: 19.9%
Dependent repos count: 21.5%
Downloads: 42.3%
Maintainers (1)
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • sphinxcontrib-bibtex *
requirements.txt pypi
  • astropy >=3.2.3
  • beautifulsoup4 >=4.9.0
  • bilby ==0.5.9
  • matplotlib >=2.2.3
  • nestle >=0.2.0
  • numpy >=1.18.1
  • pandas >=1.0.1
  • prettytable >=0.7.2
  • scipy >=1.1.0
  • xlrd >=1.1.0