specadd creates a multiple X-ray spectrum FITS file by stacking or putting together (``adding'') two single spectrum files. It can also be used to add a single spectrum file to an already existing multiple spectrum file.
This type of spectral files is particularly useful when the user wants to simultaneously analyse different observations of the same object carried out with the same instrument or with different instruments. It would be easier to handle a large number of spectral datasets if they form a single data file than if they reside in different spectral files. For example, ten observations (performed with the same instrument and at the same observing mode) of a source taken at different epochs would require to handle ten different spectral files to be able to attach a different response file to every epoch. This would happen also if the user wants to analyse the spectra of a source taken with different instruments (example MOS1 and MOS2).
With a multiple spectrum file all the spectra could be stored together (in a unique file) since the response files (ancilliary and redistribution matrix) and background files are attached to every single spectrum.
The Data extension for a multiple spectral dataset stores one single spectrum per row, instead of one channel per row as it is the case of single spectrum files. It has at least the three mandatory columns: SPEC_NUM (scalar giving the reference number of the spectrum in the particular row), CHANNEL (variable length array column containing channel numbers for the spectra in the COUNTS column),COUNTS (variable length array column with the count values observed in each channel). Other columns (STAT_ERR (variable length array column giving the statistical error of COUNTS), ROWID, QUALITY, GROUPING,BACKFILE, BACKSCAL, CORRFILE, CORRSCAL, RESPFILE, ANCRFILE, ANCRFILE) are optional and they can be substituted by keywords if all the spectra share these values (i.e., same background file, same response file, etc.). This is the default case for STAT_ERR. Provided that none of the input spectra have this column, the output multiple spectral file will substitute it by a keyword POISSERR=T within the extension header. specadd will keep the remaining optional and mandatory columns as columns to provide the highest flexibility. This will allow the user, for example, to attach a different response or background file to each of the spectra being considered.
The resulting multiple spectrum file that can be read into XspecV.10 and higher.
Example: there are three observations of a source with three different instruments the user wants to analyse simultaneously (it is left to the user the decision of which type of simultaneous analysis is scientifically correct). The observations were carried out with MOS1 (specm1.fits), MOS2 (specm2.fits) and PN (specpn.fits). The single spectra should have their ANCRFILE, RESPFILE keywords filled out with their respective response matrices so that specadd can write these names in the appropriate columns.
The first step would be adding two of the single spectrum files into a multiple spectrum file. Then the third single spectrum and this newly created file could be added together.
specadd sets=''specm1.fits specm2.fits'' useoldsumset=false sumset=''specm1m2.fits'' specadd sets=''specpn.fits'' useolsumset=true oldsumset=''specm1m2.fits'' sumset=''specm1m2pn.fits''