Skip to main content

HEAPY

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

PyPI DOI 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, with a downloadable BibTeX entry in CITATION.bib.

HEAPY version 0.2.3 is archived on Zenodo and can be cited as:

Yang, J. (2026). HEAPY: A Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients (v0.2.3) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23283842

@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},
  year = {2026},
  version = {v0.2.3},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.23283842},
  url = {https://doi.org/10.5281/zenodo.23283842}
}

License

Heapy is distributed under the GPL-3.0 license.

Metadata

Release files for heapyx 0.2.4

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.4
File Size Uploaded Provenance Actions
heapyx-0.2.4.tar.gz 187.0 kB Without provenance Details for heapyx-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 384.4 kB

Release files / heapyx-0.2.4.tar.gz

Download URL heapyx-0.2.4.tar.gz
Size 187.0 kB
Tags Source
SHA-256 checksum
How to use checksums
406a4d88895080d0e6be105774ef1c539d6b109b78aedb4e241ab82214067457
BLAKE2b-256 checksum
How to use checksums
871248f315545c9b389182ff8e7bd2a3aeed8ba9daf0a51a6974719f8043ad0a
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.4-py3-none-any.whl

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

Security for heapyx 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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