HEASP is a C/C++/Python library to manipulate files associated with high energy astrophysics spectroscopic analysis. Currently this handles PHA, RMF, ARF and xspec table model files. The eventual plan is to be able to provide at least the functionality available in current ftools but from a single library.

The main code is written in C++ with classes for each file type. These classes and associated methods have been run through SWIG to produce Python code. C wrappers are provided for many of the C++ methods allowing simple use from C programs.

These C wrappers are compatible with an earlier C only version of HEASP with two exceptions: a) the include file required is now Cheasp.h instead of heasp.h; b) all routines which used to require a FITS file pointer now just require the filename. One consequence of b) is that files no longer need to be opened and closed by the calling program.

There are separate chapters describing the Python, C++, and C interfaces although users of Python should consult the C++ chapter for description of the classes.

Highlights of HEASP are :

  • Read and write spectra, responses, arfs and table model files.

  • Rebin spectra using grouping arrays created using a variety of methods.

  • Compress responses by removing all elements below some value. Rebin responses in either energy or channel space based on a grouping array.

  • Use a response to generate random channel numbers for a photon of a given energy.

  • Multiply a response by a model.

  • Sum both rmfs and arfs and multiply rmfs by arfs.

  • Construct type II PHA or ARF from sets of spectra or arfs. Also extract individual spectra or arfs from type II files.

  • Create table model files and interpolate on them.

Note that version 1.1 changed the definition of the Real type from float to double for consistency with its use in the xspec code however most FITS data read by these routines are single-precision.

Version 2.0 introduced set and get functions for all internal class members and made the members themselves private. The Python module now uses numpy arrays for C++ vector quantities.

qVersion 2.2 changed the storage of the rmf members which are potentially variable length vector columns in the FITS file from a single vector to a vector of vectors i.e. a single vector for each energy bin. This requires less contiguous memory (useful for very large matrices and simplifies the code.

Version 2.3 added to the table class units for parameters, the option to scale energies, and the option to have multiple spectra at each parameter grid point with the one to use selected by xspec filter expressions.

Version 2.4 was a minor update adding a new binning method to pha and fixing bugs.

HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Wednesday, 23-Mar-2022 21:09:01 EDT

HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: 23-Mar-2022