A more abstract and generalized approach

The sections above provide a simple characterization of the problem. XSPEC actually operates at a more abstract level and considers the following:

Given a set of spectra $C(I)$, each supplied as a function of detector channels, a set of theoretical models {$M(E)_j$} each expressed in terms of a vector of energies together with a set of functions {$R(I,E)_j$} that map channels to energies, minimize an objective function $S$ of $C$, {$R(I,E)_j$}, {$M(E)_j$} using a fitting algorithm, i.e.

S = S(C, \sum_j M_j \times R_j)
\end{displaymath} (2.7)

In the default case, this reduces to the specific expression for $\chi^2$ fitting of a single source

S = \chi^2 = \sum_i (C_i - R_i \times M_i)^2
\end{displaymath} (2.8)

where $i$ runs over all of the channels in all of the spectra being fitted, and using the Levenberg-Marquadt algorithm to perform the fitting.

This differs from the previous formulation in that the operations that control the fitting process make fewer assumptions about how the data are formatted, what function is being minimized, and which algorithm is being employed. At the calculation level, XSPEC requires spectra, backgrounds, responses and models, but places fewer constraints as to how they are represented on disk and how they are combined to compute the objective function (statistic). This has immediate implications for the extension of XSPEC analysis to future missions.

Multiple sources may be extracted from a spectrum. For example, in the case of the $\chi^2$ statistic, the fitting problem generalizes to minimizing

\chi^2 = \sum_i (C_i - \sum_j R_{ij} \times M_j )^2
\end{displaymath} (2.9)

and $j$ runs over one or more models. This allows the analysis of, for instance, coded aperture data where multiple sources may be spatially resolved.

Responses, which abstractly represent a mapping from the theoretical energy space of the model to the detector channel space, may be represented in new ways. For example, the INTEGRAL/SPI responses are implemented as a linear superposition of 3 (fixed) components.

Instead of explicitly combining responses and models through convolution, XSPEC places no prior constraint on how this combination is implemented. For example, analysis of data collected by future large detectors might take advantage of the form of the instrumental response by decomposing the response into components of different frequency.

Other differences of approach are in the selection of the statistic or the techniques used for deriving the solution. Statistics and fitting methods may be added to XSPEC at execution time rather than at installation time, so that the analysis package as a whole may more easily keep apace of new techniques.