Skip to main content

Python package for GRB analysis

Project description

pygrb_lc

Package to load and handle GRB (Gamma-ray bursts) light curves, their furie transformations and various other functions.

To install run the following command

pip install --upgrade pygrb_lc

or

pip3 install --upgrade pygrb_lc

Light curves

Main object in this package is LightCurve object and its children. Start by creating one

from pygrb_lc.light_curves import LightCurve # base class for ligth curve

lc = LightCurve()
print(lc)

It is created but empty, semplest way to provide data is by data argument, that requires numpy.ndarray with 2 (time, signal) or 4 (time, time_err, signal, signal_err) columns

import numpy as np

data = np.loadtxt('test.txt')
lc = LightCurve(data = data)
print(lc)

Base class can rebin data, subtract polynomial function, filter peaks, set intervals and load and save data to LIGHT_CURVE_SAVE folder in pickle format.

There are specific classes for INTERAL/SPI-ACS and Fermi/GBM instruments. They are able to load actual data from web, you need to specify it in loading_method parameter

from pygrb_lc.light_curves import SPI_ACS_LightCurve, GBM_LightCurve

lc1 = SPI_ACS_LightCurve('2020-01-01 00:00:00', 500, loading_method = 'web')
lc2 = GBM_LightCurve('2020-01-01 00:00:00', ['na'], duration = 500, loading_method = 'web')

Furie transformations

Furie transformation is performed by FurieLightCurve class. It requires LightCurve object as an argument

from pygrb_lc.furie import FurieLightCurve

lc = LightCurve(data = np.loadtxt('test.txt'))
flc = FurieLightCurve(lc, interval_t90 = (0, 10))

flc.plot()

All classes have plot method, you can provide matplotlib.pyplot.Axes object as an argument to plot on existing plot

fig,(ax1,ax2) = plt.subplots(2,1)
lc.plot(ax = ax1)
flc.plot(ax = ax2)

Catalog

Catalog class is an extension of pandas.DataFrame. It provides simplicity of manipulations and visualization and extend it with crossmatching functionality. Easiest way to start using it is to create it from existing tabular data. It is important to provide event_column argument, it is the name of column that will be used for crossmatching and comparison

from pygrb_lc.catalogs import Catalog
import pandas as pd
import numpy as np

data = np.loadtxt('test.txt')
cat = Catalog(data, columns = ['datetime','duration'], event_column = 'datetime')
cat.find_event(pd.Timestamp('2023-01-01 00:00:00'), precision = 10)

precision (in seconds) controls uncertainity that is allowed for the event. If there is no such event method will return None. There is a method of crossmatching two catalogs crossmatch, it works like inner join for SQL tables, but compares only corresponding event_column columns and allows uncertainity via precision. precision = 0 equals to exact match.

Roadmap

Add support of LightCurve class in Catalog Add support of spectra (based on current photon_data in GBM_LightCurve class) Add typical functions for approximation: Band function, power law, etc. and their interaction with LightCurve and FurieLightCurve classes.

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_lc-0.3.7.1.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

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

pygrb_lc-0.3.7.1-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file pygrb_lc-0.3.7.1.tar.gz.

File metadata

  • Download URL: pygrb_lc-0.3.7.1.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pygrb_lc-0.3.7.1.tar.gz
Algorithm Hash digest
SHA256 b365bb8c6da14e31391e0e6bf9cb32c600a7d9b0e18ff7366458ddfca79b7ec2
MD5 25b9c8c0b625e924f50c496fd0fd47b8
BLAKE2b-256 d43d2673b684c08523c1ae18515e99a9eaebbc70835a67d9f5688d90a24d06be

See more details on using hashes here.

File details

Details for the file pygrb_lc-0.3.7.1-py3-none-any.whl.

File metadata

  • Download URL: pygrb_lc-0.3.7.1-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pygrb_lc-0.3.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6b8758a3a820089fce50d74358853292c2599f5beff9dfbb40a6cad18b5e1f9
MD5 3ce1b4f8c227933d7ca6a5303afa1e11
BLAKE2b-256 928a4bdec8c50865339b29142a4cf0d5fc640981b04434db2698e677f88c34a5

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