XSPEC allows users to fit data with models constructed from individual components. These components may be either additive, multiplicative, mixing, or convolution. Additive components are emission processes such as lines, bremsstrahlung, and so on. Multiplicative components simply multiply the model by an energy-dependent factor. Convolutions apply a transformation to the model component they operated on whereby the output can be affected by a range of input energies, such as in smoothing operations. Mixing components are two-dimensional and designed to transform fluxes between different spatial regions (such as in projection). Multiplicative and convolution components can act on individual components, on groups of components, or on the entire model, whereas mixing transformations apply to the whole model.
The model command defines the model to be used and prompts for the starting values of its parameters. The user also can set the allowed ranges of the parameter. Parameters can be linked to an algebraic function of the other parameters, and unlinked using the untie command. The value of an individual parameter can be changed with the command newpar (and the current setting queried with the special case of newpar 0). Parameters can be fixed at their current value with the freeze command and allowed to vary freely with the thaw command. Individual components can be added to or subtracted from the model using addcomp, delcomp, and editmod.
The flux command calculates the flux from the current model in the given energy range. This energy range must be within that defined by the current response matrix. If a larger energy range is required, then the energies command can be given to compute the model over the desired range. The lumin command calculates the luminosity for the source redshift given. The eqwidth command determines the equivalent width of a model component, usually a line. The user of either of these last two commands should read the help descriptions carefully. The Tcl script addline can be used to automatically add lines to a model. These can be identified using identify and modid.
New model components which can be described by a simple algebraic formula can be set up using mdefine and used in the same way as the standard models except they will run slower being interpreted rather than compiled.
Models with multiple responses and background models
Multiple models and responses can be assigned to a single spectrum.3.1 The spectrum is considered to come from a number of sources, each of which may have its own model and response. In the FITS file format, a single response file can be associated with a spectrum either through a header keyword or a table column entry. XSPEC always assigns this response to a spectrum's source number 1. The model command by default also creates new models for source number 1. The response command in tandem with model can be used to create additional sources. For example, to add a background model to the first loaded spectrum, load a 2nd response for this spectrum:
XSPEC12> response 2:1 resp2.rspthen define a background model to apply to source 2:
XSPEC12> model 2:my_background_model_name wa(po)This model will now apply to the first spectrum and any other spectrum that has a response loaded for source 2. To apply a different background model to a second spectrum, load a response for source 3 rather than 2:
XSPEC12> response 3:2 another_response.rsp XSPEC12> model 3:another_background_model gaAn arf can also be assigned to a particular source number and spectrum. For instance, to add an arf for the second source for the first spectrum:
XSPEC12> arf 2:1 arf_file.phaSource numbers do not need to be entered in consecutive order for a given spectrum, and gaps in numbering are allowed. Please see the individual model and response entries in the ``XSPEC Commands'' section for more information and examples.