Spectrum extraction is turned on by setting the parameter spectrumset, which specifies the name of the output spectrum file. A spectrum, as defined here, is an OGIP compliant FITS file, made by histogramming the energy column of an input table. The energy column must be integer-valued, and any specified binning factor or energy ranges must be integer-valued as well. The column to histogram is specified with the parameter energycolumn. More general histogramming of real-valued columns can be performed using the histogram extraction utility in evselect. If a real-valued column is fed to the spectrum extractor, then a warning is issued, and all values in the column are truncated to integers before being accumulated into a spectrum. Note that the parameter energycolumn is also used in light curve extraction (see below).
evselect performs true binning of spectral files, as opposed to OGIP grouping. The binning factor is set via the parameter spectralbinsize, which is set to 10 by default. The energy range for the spectrum is determined in one of three ways. First, if the parameters specchannelmin and specchannelmax are set, they are used for the spectral range. If these values are not set, then the input data set is queried for the TLMIN and TLMAX attributes of the energy column, and if available these are used for the energy range. Finally, if no other information is available, then the actual range of the energy column data itself is used as the minimum and maximum values for extraction of the spectrum. Note that if specchannelmin or specchannelmax exceed the allowed data range set by TLMIN and TLMAX, then a warning message is issued, and the range is adjusted to be within the allowed limits. If the parameter ignorelegallimits is set to true, then the keywords TLMIN and TLMAX are ignored, that is they are treated as if their values are not set. All range and binning parameters are in the units of the column from which the data is being extracted.
As the energy range and binning factor of the spectrum is needed by down-stream software (for example to produce an RMF file), this information is written to keywords in the spectrum file, using a WCS style specification. The keyword SPECPIX gives the value of the reference channel in the spectrum. The keyword SPECVAL then is set to the value of the energy column which corresponds to the center of the spectrum's reference channel. The keyword SPECDELT is set to the binning factor.
For XMM only data, one can produce a spectrum of rates rather than counts, using the exposure information available in the XMM event files. In this case a ``weight'' column must also be specified, and is used to specify the weight given to each event in the event list. This is activated by setting the name of the weighting column using the parameter zcolumn. An error on the weight can also be specified using the zerrorcolumn parameter. If this parameter is not set, then the error on the weight is set to the value of the weight itself. Each weight is divided by the exposure time for the particular CCD from which the event originated, and these values are summed on a bin by bin basis to create the spectrum of rates. See the section on exposure information for more details on how the CCD exposures are calculated.
evselect does not calculate the BACKSCAL keyword, but simply sets its value to unity. The task backscale calculates a proper value for this keyword.