Creating FITS format files for XSPEC

RMF files

The definition of the FITS format for response matrix files can be found in the OGIP document CAL/GEN/92-002 with modifications in CAL/GEN/92-002a. The format comprises a primary header and two binary table extensions. There are routines available in the FTOOLS CALLIB subroutine library which can be used to create the binary table extensions. These are : These routines can be found in the FTOOLS distribution in the directory callib/src/gen.

The RSP_MATRIX extension stores the matrix in a compressed format described in CAL/GEN/92-002. An example subroutine, cmprsp, shows how this compressed format is generated from a standard matrix.

Another example subroutine shows how to create the RMF fits file and attach the EBOUNDS and RSP_MATRIX extensions using the CALLIB routines.

ARF files

The definition of the FITS format for the ancillary response file can be found in the OGIP document CAL/GEN/92-002 with modifications in CAL/GEN/92-002a. The format comprises a primary header and a binary table extension. The SPECRESP binary table extension can be created by the routine wtarf1.f in the FTOOLS CALLIB subroutine library. This routine can be found in the FTOOLS distribution in the directory callib/src/gen.

Spectral files

The definition of the FITS format for the spectral file can be found in the OGIP document OGIP/92-007. The format comprises a primary header and a binary table extension. The SPECTRUM binary table extension can be created using the routine wtpha2.f in the FTOOLS CALLIB subroutine library. This routine can be found in the FTOOLS distribution in the directory callib/src/gen. The routine wt_spec.f in the same directory provides an example use of wtpha2.

Linking to the required libraries

To use the routines described above you need to have an installed copy of the core FTOOLS distribution, including the libraries libcaltools.a, libftools.a, and libfitsio.a. The link line in the makefile should include :
-L$FTOOLS/lib -lcaltools -lxanlib -lftools -lfitsio
where $FTOOLS is the top level system-dependent directory of the installed ftools.