Skip to main content

HEAPY

A Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients.

PyPI Examples License GPL-3.0


Heapy is a Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients. It pulls event and response data from mission archives, reduces time-tagged-event (TTE) and image data into light curves and OGIP spectra, separates burst signals from fitted backgrounds, and measures durations, spectral lags, and source localizations — across Fermi/GBM, GECAM, GRID, Einstein Probe (WXT/FXT), and Swift (XRT/BAT). It bridges to HEASoft and gbm_drm_gen for mission-specific reduction and response generation.

Features

  • Data retrieval. Pull event, position, and response files straight from mission archives by burst ID, UTC window, or observation ID (gbmRetrieve, gecamRetrieve, gridRetrieve, epRetrieve, swiftRetrieve).
  • Multi-mission event reduction. One Event interface across Fermi/GBM TTE, GECAM, GRID, Einstein Probe (WXT/FXT), and Swift (XRT/BAT).
  • Light curves. Extract and rebin light curves with automatic background fitting.
  • Signal detection. Bayesian-block signal/background separation with three noise regimes — Poisson + polynomial background (pgSignal), Poisson + supplied background (ppSignal), and Gaussian (ggSignal).
  • OGIP spectra. Generate source and background PHA/PHA2 spectra, and — for Fermi/GBM — response matrices via gbm_drm_gen.
  • Timing analysis. Duration measurements (T90/Txx) and spectral-lag estimation.
  • Localization & geometry. Detector geometry, sky maps, and source localization.

Installation

Heapy requires Python 3.10 or later and is available on PyPI:

pip install heapyx

Optional: HEASoft

For some missions (e.g., Swift), heapy invokes HEASoft tools such as xselect and ximage. Ensure HEASoft is installed, along with the Calibration Database (CALDB) for the mission you are processing.

Optional: Fermi GBM response generator

To build response matrices for Fermi/GBM, heapy calls gbm_drm_gen. The forked packages below are fine-tuned for newer numpy/astropy and use TTE instead of CSPEC data:

git clone https://github.com/jyangch/responsum.git
pip3 install ./responsum

git clone https://github.com/jyangch/gbmgeometry.git
pip3 install ./gbmgeometry

git clone https://github.com/jyangch/gbm_drm_gen.git
pip3 install ./gbm_drm_gen

Documentation

Browse the examples for typical workflows end to end.

Citation

If you use HEAPY in your research, please include a software citation in your reference list and state the version used in your methods section. Citation metadata are available in CITATION.cff.

Until a DOI-backed release is available, the repository can be cited as:

Yang, J. HEAPY: A Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients [Computer software]. https://github.com/jyangch/heapy

@software{heapy,
  author = {Yang, Jun},
  title = {{HEAPY}: A Python toolkit for data reduction, temporal analysis, and
           spectral extraction of X-ray and gamma-ray transients},
  url = {https://github.com/jyangch/heapy}
}

License

Heapy is distributed under the GPL-3.0 license.

Metadata

Release files for heapyx 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for heapyx 0.2.3
File Size Uploaded
heapyx-0.2.3.tar.gz 185.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for heapyx 0.2.3
File Interpreter ABI Platform
heapyx-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 381.7 kB

Release files / heapyx-0.2.3.tar.gz

Download URL heapyx-0.2.3.tar.gz
Size 185.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a2a280d82e160d14389c8cc933052f2f88d95df99635d2d22c8394f51a508634
BLAKE2b-256 checksum
How to use checksums
49960dbd55516164c91406c2c72ce9d3cd83458af301ccd9b16cbd4e26591f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / heapyx-0.2.3-py3-none-any.whl

Download URL heapyx-0.2.3-py3-none-any.whl
Size 196.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9437141d76aaaa53d4ecda1903aca44a46c11428b0f54e782938e14f137bc701
BLAKE2b-256 checksum
How to use checksums
c7698fb48c5cda5cd6d2731889c25698fc39e09d6d3f3c7c23023ca5820e3cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page