Introduction

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 :

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.

Version 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.

Version 2.5 changes the heasp.h file so it doesn't include using namespace directives for std and CCfits and it places all its own variables and functions in a namespace called heasp. This means that any programs using heasp and using std and/or CCfits routines may need changing either by explicitly using std::, CCfits::, or heasp:: for the appropriate routines or by adding their own using namespace directives. This version also adds support for spectropolarimetry keywords.