The XSPEC implementation

To summarize the preceding section, the main components of spectral fitting are as follows:

These components are used in the following manner:
  1. Choose a parameterized model which is thought to represent the actual spectrum of the source.
  2. Choose values for the model parameters.
  3. Based on the parameter values given, predict the count spectrum that would be detected by the spectrometer in a given channel for such a model.
  4. Compare the predicted spectrum to the spectrum actually obtained by the instrument.
  5. Manipulate the values of the parameters of the model until the best fit between the theoretical model and the observed data is found.
  6. Then calculate the “goodness” of the fit to determine how well the model explains the observed data, and calculate the confidence intervals for the model's parameters.

This section describes how XSPEC performs these tasks.

C(I): The Observed Spectrum

To obtain each observed spectrum, $C(I)$, XSPEC uses two files: the data (spectrum) file, containing $D(I)$, and the background file, containing $B(I)$. The data file tells XSPEC how many total photon counts were detected by the instrument in a given channel. XSPEC then uses the background file to derive the set of background-subtracted spectra C(I) in units of counts per second. The background-subtracted count rate is given by, for each spectrum:

C(I) = {D(I)\over{a_{D(I)}t_D}} - {b_{D(I)}\over{b_{B(I)}}} {B(I)\over{a_{b(I)}t_B}}
\end{displaymath} (2.3)

where $D(I)$ and $B(I)$ are the counts in the data and background files; $t_D$ and $t_B$ are the exposure times in the data and background files; $b_{D(I)}$ and $b_{B(I)}$, $a_{D(I)}$ and $a_{B(I)}$ are the background and area scaling values from the spectrum and background respectively, which together refer the background flux to the same area as the observation as necessary. When this is done, XSPEC has an observed spectrum to which the model spectrum can be fit.

R(I,E): The Instrumental Response

Before XSPEC can take a set of parameter values and predict the spectrum that would be detected by a given instrument, XSPEC must know the specific characteristics of the instrument. This information is known as the detector response. Recall that for each spectrum the response $R(I,E)$ is proportional to the probability that an incoming photon of energy $E$ will be detected in channel $I$. As such, the response is a continuous function of $E$. This continuous function is converted to a discrete function by the creator of a response matrix who defines the energy ranges $E_j$ such that:

R_D(I,J) = {\int_{E_{J-1}}^{E_J} R(I,E) dE\over{E_J - E_{J-1}}}
\end{displaymath} (2.4)

XSPEC reads both the energy ranges, $E_J$, and the response matrix $R_D(I,J)$ from a response file in a compressed format that only stores non-zero elements. XSPEC also includes an option to use an auxiliary response file, which contains an array $A_D(J)$ that is multiplied into $R_D(I,J)$ as follows:

R_D(I,J) \rightarrow R_D(I,J) \times A_D(J)
\end{displaymath} (2.5)

This array is designed to represent the efficiency of the detector with the response file representing a normalized Redistribution Matrix Function, or RMF. Conventionally, the response is in units of cm$^2$.

M(E): The Model Spectrum

The model spectrum, $M(E)$, is calculated within XSPEC using the energy ranges defined by the response file :

M_D(J) = \int_{E_{J-1}}^{E_J} M(E) dE
\end{displaymath} (2.6)

and is in units of photons/cm$^2$/s. XSPEC allows the construction of composite models consisting of additive components representing X-ray sources (e.g., power-laws, blackbodies, and so forth), multiplicative components, which modify additive components by an energy-dependent factor (e.g., photoelectric absorption, edges, ...). Convolution and mixing models can then perform sophisticated operations on the result. Models are defined in algebraic notation.

For example, the following expression:

  phabs (power + phabs (bbody))
defines an absorbed blackbody, phabs(bbody), added to a power-law, power. The result then is modified by another absorption component, phabs. For a list of available models, see Chapter 6.