One can write XSPEC commands into a file and have them executed by entering @filename at the XSPEC prompt. Also, one may enter from the shell prompt
% xspec - filename &
for batch execution (remember to end the script in file filename with exit if you want the program to terminate after completion!). Note that the default suffix for xspec scripts is .xcm
The save command writes out a file of XSPEC commands, which, when run, will restore XSPEC to the state it was in when the save command was issued. This command is very useful when reading a large number of data sets and/or fitting complicated models. If autosaving is operating (the default) then the equivalent of save all xautosav.xcm is run after each command, so if a disaster occurs it is possible to recover.
The string /* acts as an emergency escape back to the XSPEC prompt. If one gives this string in answer to any question then one should be bounced out of whatever one is doing and returned to the XSPEC prompt. Counterexamples to this should be sent to firstname.lastname@example.org.
If one has a response file for an instrument and wants to make some fake spectra, then the command fakeit none should be used. XSPEC will prompt the user for the response and ancillary filenames from which to build the simulated data. It is important to note that one must define a model prior to issuing the fakeit command.
XSPEC uses the PGPLOT package, which comes with a standard set of device drivers. Any X-windows terminal should support /xw while xterm windows should support /xt.
The easiest way of making a hardcopy of an XSPEC plot is to use the iplot command and then at the PLT prompt to enter hard /ps. This will make a file called pgplot.ps which can be printed.
The most common use of XSPEC is to fit one or more data sets with responses to a particular model. However, it is often useful to be able to fit simultaneously several data sets with a model whose parameters can be different for each data set. A simple example would be a number of data sets that we expect to have the same model spectrum shape but different normalizations. XSPEC caters to this need through the use of data groups. When files are read in they can be labelled as belonging to a particular data group. When a model is defined a set of model parameters is allocated for each data group. These parameters can all vary freely or they can be linked together across data groups as required.
To set up data groups, the data command should be given as in the following example :
XSPEC> data 1:1 file1 1:2 file2 2:3 file3
which sets up two data groups. The first data group comprises data sets from file1 and file2, and the second data group takes the data set from file3. Now when a model is defined, XSPEC will give two sets of model parameters, one for the first datagroup and one for the second.
The statistic assumes that all the spectral channels are Gaussian distributed and that the estimate for the variance is uncorrelated with the observed counts. If there are small numbers of counts in a channel these will not be true. An alternative statistic, the C-statistic, can be used in this case. The C-statistic now in use does provide a goodness-of-fit if there are enought counts and this can be checked using the goodness command which uses Monte Carlo methods. This C-statistic can also provide confidence intervals in exactly the same way as . So give the command stat cstat and then use the fit and error commands as usual. An alternative approach is to continue using the statistic but change the weighting to provide a better estimate of the variance in the small number limit. This can be done using the weight gehrels or weight Churazov commands. The latter is to be preferred.
Often one does not want to use the full resolution of a spectrum, either because the channels oversample the spectral resolution or because the S/N is low. XSPEC and the associated programs provide a number of ways of handling this. Firstly, the XSPEC setplot rebin command can be used to add channels together in the plot. It is important to realise that this effects only the plot and not the data being fitted. Two FTOOLS are available to bin and group data for fitting purposes. RBNPHA bins up the data in a non-reversible manner and should only be used to ensure that the number of bins in the spectrum is the same as that in the response. GRPPHA is the tool of choice for grouping the data to get adequate S/N or number of counts in each channel. GRPPHA does not actually add together channels, but instead sets a flag which is read by XSPEC and causes XSPEC to sum the appropriate channels. If a data file is read with some grouping then XSPEC will apply the same operation to any background or response files used.
The fit command in XSPEC will run a certain number of iterations and then query the user whether he or she wants to continue. While useful under most circumstances, the constant questioning can be a pain if one leaves XSPEC running and expects to find it finished when one gets back, or if one habitually runs scripts. One way around this problem is to reset the number of iterations before the question is asked by giving a single argument on the fit command. For example, fit 100 will run 100 iterations before asking a question. A more drastic solution is to use the query command. query yes will suppress all questions and assume that their answer is yes while query no will suppress all questions but assume that their answer is no.
Arnaud, K.A., George, I.M., Tennant, A.F., 1992. Legacy, 2, 65.
Avni, Y., 1976. ApJ, 210, 642.
Bevington, P.R., 1969. Data Reduction and Error Analysis for the Physical Sciences, McGraw-Hill.
Blissett, R.J., Cruise, A.M., 1979. MNRAS, 186, 45.
George, I.M., Arnaud, K.A., Pence, W., Ruamsuwan, L., 1992. Legacy, 2, 51.
Kahn, S.M., Blissett, R.J., 1980. ApJ, 238, 417.
Loredo, T.J., Epstein, R.I., 1989. ApJ, 336, 896.
Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P., 1992. Numerical Recipes (2nd edition), p687ff, CUP.
Wheaton, W.A. et.al., 1995. ApJ, 438, 322.