XSPEC is a command-driven, interactive, X-ray spectral-fitting program, designed to be completely detector-independent so that it can be used for any spectrometer. XSPEC has been used to analyze data from HEAO-1 A2, Einstein Observatory, EXOSAT, Ginga, ROSAT, BBXRT, ASCA, CGRO, IUE, RXTE, Chandra, XMM-Newton, Integral/SPI, Swift and Suzaku. There now over 1000 papers listed on ADS which cite the Arnaud 1996 XSPEC reference.
This manual describes XSPEC v12, which is available on Linux (gcc 3.2.2 and later), MacOSX/Darwin (gcc 3.3 and later) , Solaris (2.6-9; WS6.0 and later). New users are advised to read Chapter 2, which introduces spectral fitting and the XSPEC approach, Chapter 3, which gives an overview of the program commands, and Chapter 4, which contains walkthroughs of XSPEC sessions. They should then experiment with XSPEC and, if necessary, look up individual commands in Chapter 5, or descriptions of the spectral models in use, in Chapter 6.
The User Interface for XSPEC, which employs a tcl scripting shell and the XSPEC parser are described in Appendix A. Users possessing X-ray spectra with small numbers of counts per bin are referred to Appendix B, which describes the C-statistic option. Users interested in adding their own models can read how to do so in Appendix C. Appendix D describes the PLT plotting package which XSPEC currently uses for graphical output. Some of the tools (FTOOLS, fortran programs, scripts) that can operate on XSPEC files are listed in Appendix E. The XSPEC model library can be linked into other programs following the instructions in Appendix F. Appendix G describes how to use your own proposal distribution for Markov Chain Monte Carlo. Finally, Appendix H includes some notes on the changes between XSPEC v11 and v12.
New features:
· Parallel-processing capability for specific tasks has been added by way of the new "parallel" command. This allows the user to set a maximum number of processes to spawn when running certain XSPEC commands. Currently the options for parallel-processing are limited to use with the "fit" and "error" and commands, though we plan to implement more in the near future. This first implementation is considered to be a BETA release, and we look forward to hearing your comments and suggestions.
· XSPEC now distinguishes between the 'fit' statistic and the 'test' statistic. The fit statistic is used to find the best-fit parameter values and errors while the test statistic is used to provide a goodness-of-fit. Consequently, the goodness command now uses the test statistic. Separating these two classes of statistic has allowed us to add a number of new test statistics. These include Kolmogorov-Smirnov and the related Anderson-Darling and Cramer-von Mises. Also new are the runs statistic, based on the number of runs of consecutive positive (or negative) residuals, and the Pearson Chi-Square (pchi) statistic, Pearson's original test statistic.
· The basic Levenberg-Marquardt fit algorithm has undergone a number of changes. The most visible is an additional column in the output during the fit. |beta|/N is the norm of the vector of derivatives of the statistic with respect to the parameters divided by the number of parameters. At the best fit this should be zero so provides another measure of how well the fit is converging. |beta|/N can also be used as the criterion to stop the fit instead of the statistic delta although this is still considered experimental.
Other internal changes to the fit algorithm are to treat the first iteration as a special case where only normalizations are allowed to change and to add the option of using delayed gratification, which can speed up convergence.
· New models: compmag, comptb, rgsxsrc. The latter is reinstated from it use in XSPEC v11.
· New plotting command "plot goodness", for plotting a histogram of the most recent "goodness" simulation.
· New tclout option "goodness sims".
· Added the option of using the Goodman-Weare algorithm instead of Metropolis-Hastings when using the chains command to run MCMC.
· Added the Whittle statistic for fitting models to power density spectra.
· If a data file is read which has RESPFILE="[]" then the response extensions (MATRIX, EBOUNDS) are read from the same file.
· Added support for a new type of model component: a mixing component which operates on the model pre-multiplied by the effective area. This is similar to the pile-up model type but allows for a models which require mixing between multiple spectra.
· Table model files can now have interpolated and additional parameters intermixed provided that additional parameters are indicated by METHOD=-1 in the PARAMETERS extension.
Enhancements previously released as patches to 12.7.1:
· The "plot chain" has a new "thin" option for thinning the display of chain points.
· Added a "tclout ignore" option for easy retrieval of currently ignored channels. Similar capability added to PyXspec's Spectrum class.
All bug fixes to v12.7.1 released as patches are included in v12.8.0. In addition the following problems have been corrected:
· The eqpair model used wrongly-sized arrays when multiple spectra were used with RMFs having varying numbers of photon energy bins. Eqpair (plus eqtherm and compth) also needed a new default value for its optical depth parameter, which fixes the problem if parameter 4 is zero.
· A fit parameter which started close to the minimum/maximum could under some circumstances be incorrectly pegged at the maximum/minimum.
· When the "error" command was run on a model with soft limits (ie. soft limits for some parameters set to a narrower range than hard limits), and the best fit value fell within the soft limit region, the displayed differences (in parentheses) were not consistent with the reported ± limits.
· Problem occurred in apec model when zero width lines were in the final energy bin.
· Fix to a potential normalization problem occurring in lorentz model with low-energy large-width lines.
· When running initpackage/lmod from PyXspec on certain Linux builds, local models calling functions in XSPEC's xslib library producing unresolved symbol link errors.
XSPEC is distributed and maintained under the aegis of the GSFC High Energy Astrophysics Science Archival Research Center (HEASARC). It can be downloaded as part of HEAsoft
http://heasarc.gsfc.nasa.gov/docs/software/lheasoft/download.html
XSPEC is available either as binaries or source. We recommend downloading the source and compiling locally to avoid potential system library conflicts and allow installation of any patches we release. If you have any problems compiling or running XSPEC please e-mail us at
The XSPEC Web page comprises links to the anonymous ftp site, a Web version of the manual, and several useful documents, including a list of known bugs. The Web address is
with the list of issues and available patches at
http://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/bugs.html
and additional models which can be added at
http://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/newmodels.html
Further useful information can be found on the XSPEC Wiki at
https://astrophysics.gsfc.nasa.gov/XSPECwiki/XSPECPage
and the xspector blog at
The first version of XSPEC was written in 1983 at the Institute of Astronomy, Cambridge, under VAX/VMS by Rick Shafer. It was written to perform spectral analysis of data from the ESA EXOSAT X-ray observatory, which was launched that year. XSPEC is a descendant of a series of spectral-fitting programs written at NASA/Goddard Space Flight Center for the OSO-8, HEAO-1 and EO missions. The initial design was the fruit of many discussions between Rick Shafer and Andy Szymkowiak. Rick Shafer subsequently joined the EXOSAT group, where he enhanced the VAX/VMS version in collaboration with Frank Haberl. Meanwhile, Keith Arnaud ported XSPEC to a Sun/UNIX operating system. The two implementations of XSPEC diverged for several years until a determined and coordinated effort was made to recover a single version. The results of that effort was XSPECv6, described in the first edition of this manual. Subsequent editions have covered later versions of the program. In recent years XSPEC has become the de facto standard for X-ray spectroscopic analysis for the ROSAT mission and the de jure standard for the BBXRT, ASCA, and RXTE missions. It is now in extensive use for all current X-ray and gamma-ray missions. An extensive re-engineering effort was started in the fall of 1998 to improve long-term maintainability, allow significant new features to be added, and support the analysis of spectra from coded-mask instruments.
This project would not have been possible without ignoring the advice of far more people than can be mentioned here. We would like to thank all our colleagues for their suggestions, bug reports, and (especially) source code. The GSFC X-ray astronomy group are particularly thanked for their patience exhibited while functioning as the beta test site for new releases. The initial development of XSPEC was funded by a Royal Society grant to Prof. Andy Fabian and subsequent development was partially funded by the European Space Agency's EXOSAT project and is now funded by the HEASARC at NASA/GSFC.
Dorman, B., Arnaud, K. A., and Gordon, C. A. XSPEC12: Object-Oriented X-Ray Data Analysis, AAS HEAD meeting No. 35, #22.10