The task first reads the files containing the input source and background EPIC spectra FITS files. Then it checks some of the keywords existence and validity : INSTRUMENT = 'EMOS1' , 'EMOS2' OR 'EPN' ; HDUCLASS = 'OGIP' ; HDUCLAS1 = 'SPECTRUM' ; HDUCLAS2 = 'TOTAL' (for source) and 'BKG' (for background) ; HDUCLAS3 = 'COUNT' ; CHANTYPE = 'PI'. If necessary an error is raised and the task exits properly.
To determine whether the background spectrum file corresponds to the source spectrum file, the only checks performed are about number of PI channels and instrument names which must be the same for the source and background spectral file.
The net source spectrum is computed by subtracting channel by channel, the normalized background spectrum from the source spectrum. The net source and background spectra are rebinned using the same binning scheme and then normalized. They are drawn logarithmically with their error bars on the same page. The X-axis and Y-axis are labelled as Energy (keV) and counts/s/keV respectively.
If the device selected is not valid (i.e. does not belong to the list of devices supported by the task), the task exits properly. The same happens if the device selected is one of the devices requesting an output file and the output file is invalid. If the output file already exists, the task issues a warning and overwrites the output file, providing that the environment variable SAS_CLOBBER is set to 1 or is unset.
The following information is added to the plot: the telescope name; the instrument; its mode of operation; the date of the observation (start, stop); the source; and the background exposure time. The XMM observation ID, the name of the target object, and name of the PI are also indicated on the plot. If some of this information is not available, a blank string is used.