skip to content
ROSAT Guest Observer Facility

GETTING TO XSPEC - a cheat sheet

There are three main ways to get from ROSAT data to spectral files ready for XSPEC:

Methods I & II: using PROS (v.2.3):

  • I. *IF* your source is on-axis, and you have FTOOLS:
    • use "xdataio.fits2qp" to make a qp file from your fits events list
    • use "xspectral.qpspec" to extract your spectrum * make sure to set the following for PSPC data:

      full = yes

      channels = 256

      binning = pi

    • use "tables.fitsio.stwfits" under IRAF-TABLES to convert all 3 of the spectral files (*, *, * to fits format
    • use the stand alone FTOOL "stw2pha" to create a ".pha" file from your spectral fits files. It's normal to get several warning messages about the file format. For help, type "fhelp stw2pha".

  • II. *IF* your source is off-axis, or you *don't* have FTOOLS: * follow steps 1 and 2 above.
    • use "xspectral.downspecrdf" to convert the spectral files to a "backwards compatible" format
    • use "proscon" v.2.3 (part of XANADU package) on the file made by "downspecrdf". Proscon will create .pha and .rsp files for use in XSPEC. Proscon can be obtained from the legacy anonymous ftp area under /rosat/software/fortran/proscon/

  • Method III: using XSELECT:

    XSELECT is now available for ROSAT data analysis. Page 23 of the "ROSAT data analysis using xselect & ftools" Guide contains a brief recipe of how to create a spectral file for XSPEC. (The Guide is available in the ROSAT anonymous-FTP area: cd to /rosat/doc/xselect_guide on The whole Guide is short and easy to printout; we recommend users look it over before starting their ROSAT data analysis in XSELECT.


ROSAT PSPC "pi" spectra extracted with the xspectral task QPSPEC (PROS 2.3.1) may be used for XANADU/XSPEC spectral fitting either via the interface program PROSCON (v. 2.3), or via a newly-implemented FITS file interface consisting of the IRAF task fitsio.stwfits followed by ftools.caltools.stw2pha (which is also available within IRAF). However, implementation of this FITS-file interface has meant that input PSPC spectra (for PROSCON as well) must be at full 256-channel resolution, which differs from the normal PROS practice of working with "down-binned" spectra in 34 (coarser) energy bins (cf. "help pspc_fitting" in PROS). To generate the 256-channel spectra now required, users must set the QPSPEC boolean parameter "full" to YES, i.e.,

        cl> xray
        xi> xspectral
        xs> qpspec full=yes

XSPEC users are cautioned, however, that in order to avoid cases in which many channels have too few or zero counts, such spectra should be rebinned before importing to XSPEC. Spectra can be prepared for rebinning in XSPEC by using the GRPPHA from FTOOLS. (CHANPHA/group in XANADU also works on the output of PROSCON 2.1, which produced XSPEC binary files, but CHANPHA will NOT accept the new FITS format files.)

However, such rebinning may significantly overestimate the errors associated with each bin, leading to anomalously low values of chisq, if the default error calculations have been performed in QPSPEC (cf., in PROS, "help explain_errors"). This problem arises because the rebinning specification column that GRPPHA adds to the FITS file causes XSPEC to sum errors in quadrature when reading the spectra, normally a correct procedure. However, in order to deal with low/zero-count bins, QPSPEC uses an approximation for the "1-sigma" errors that does NOT sum in quadrature to a value equivalent to that calculated from the summed counts.

As illustrated in the PROS dialogue below, the problem of low chisq values can be avoided by changing the POISSERR keyword of the QPOE file header (see Footnote below) before running the qpspec task in PROS.

The following PROS dialogue (see also Footnote below) illustrates the generation of PSPC pi spectra for input to PROSCON or the FITS interface (stwfits + stw2pha):

xs> qpcopy xdata$rp110590n00.qp FIELD arlac.qp ""
xr> ximages
xs> qphedit arlac.qp POISSERR F
        arlac.qp,POISSERR (T -> F): yes
        arlac.qp,POISSERR: T -> F
        continue ? : yes
        arlac.qp updated
xs> imhead arlac.qp long+ | match POISSERR
                  POISSERR=                    F
xs> qpspec full=yes
        source qpoe file : arlac.qp
        source region descriptor : c 6930 9390 240
        background qpoe file : arlac.qp
        background region descriptor : a 6930 9390 300 600
        root name for output files [, etc.] : arlac
        Output table file(s):,,
xs> downspecrdf
        list of root names for files to convert [] : arlac
        Output (pre-RDF) table file:

It should be noted, however, that the problem of assigning errors to few/zero-count spectral bins is an intrinsic one. Some users may prefer to use the C-statistic fitting option available in XSPEC (although this technique does not provide a measure of the "goodness of fit"). While not rigorous, PROS' use of approximate "1-sigma" errors is an approach that other users may find adequate.

           The QPOE header keyword POISSERR was added when the RDF
           formats were introduced (PROS release 2.3, 24 DEC 93).
           PROS supports data in pre-RDF and RDF format, but will
           always write output files in RDF format.  The PROS ROSAT
           FITS readers (rarc2pros, rfits2pros) will do any required
           conversions automatically.  However, existing, pre-RDF
           format QPOE files must be converted manually by the user,
           with the task UPQPOERDF:

             xr> xdataio
             xd> upqpoerdf *.qp

If you have problems with any of the above, please send mail to: Curator: Michael Arida (SP Sys);
HEASARC Guest Observer Facility
Please use the Feedback link if you have questions on ROSAT.

This file was last modified on Wednesday, 28-Jul-1999 09:30:35 EDT

NASA Astrophysics

  • FAQ/Comments/Feedback
  • Education Resources
  • Download Adobe Acrobat
  • A service of the Astrophysics Science Division (ASD) at NASA/ GSFC

    ROSAT Project Scientist: Dr. Robert Petre

    Responsible NASA Official: Phil Newman

    Privacy Policy and Important Notices.

    Last Update: June 5, 1995