Data Commands

XSPEC is designed to allow complicated, multi-instrument analysis, so most commands can take arguments specifying more than one data set. Arguments in XSPEC are separated by either blanks or commas. A single argument can define a range. The ranges are delimited by a dash (-). A colon (:) is used to separate ranges (e.g., the phrase 1-2:11-24 refers to channels 11-24 in files 1 and 2).

Reading data and modifying calibration and auxiliary files

XSPEC reads in spectra from spectral files using the data command. Several datasets may be specified in one command. Several datasets may be stored in a single file and accessed separately. A particular dataset in use may be replaced by another or dropped entirely. The input data file contains pointers to background, redistribution and auxiliary response files, but these pointers may be overridden by the backgrnd, response, and arf commands. All these commands have the same syntax as the data command. An auxiliary background file, called the correction file (an absolute subtraction with zero variance), also can be included using the corfile command. Its use is described in the section on fitting. The current response can be replaced by a diagonal version using diagrsp. A dummy response for testing purposes can be defined using dummyrsp.

Controlling channels being fitted

PHA channels may be left out of fitting using the ignore command and included again using the notice command. These commands have a syntax allowing the same channels to be specified for more than one input file. The ignored and noticed ranges can be specified either as channels or as energies. If the command setplot wave has been entered, real ranges are interpreted as wavelengths.


The fakeit command is used to generate simulated data. The current response matrix and model (a model must be defined prior to using the fakeit command) are used to create fake data. The user is prompted for various options. To make fake data when only a response matrix is available, give the command

XSPEC12> fakeit none
XSPEC will prompt the user for the response and ancillary filenames from which to build the simulated data.

Data groups

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 simultaneously fit 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 labeled 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 :

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

HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Tuesday, 28-May-2024 10:09:22 EDT