SIMRES - Create simulation files based on existing response

Simres is a script to create a SPEX format spo and res file from just an input response file, optionally with an effective area file (ARF) and background spectrum. This is very useful to create spo and res files for future missions, where only responses and effective area files are provided. The spo and res files can be used to simulate spectra in SPEX.

The parameters of simres can be shown on the command line by the ‘-h’ flag:

simres -h

Example

Suppose we have a response matrix from a future instrument like X-IFU aboard Athena called athena_xifu_A.rsp, then we can create a spo and res file with the simres command, and call them xifu.spo and xifu.res:

linux:~> simres --rmffile athena_xifu_A.rsp --spofile xifu.spo --resfile xifu.res
==================================
 This is simres version 0.2.8
==================================

Read RMF response matrix... WARNING This is an RSP file with the effective area included.
Do not read an ARF file, unless you know what you are doing.
OK
Check OGIP source spectrum... OK
Check OGIP response matrix... OK
Convert OGIP spectra to spo format... OK
Convert OGIP response to res format... OK
Identify bad channels in spectrum and response matrix and re-index matrix... OK
Number of good channels: 29600
Number of bad channels:  0
Removing bad channels from spectral region... OK
Number of original groups:       29600
Number of zero-response groups:  0
Number of original response elements:  8898275
Number of bad response elements:       0
Removing bad channels from response matrix... OK
Writing SPO to file: xifu.spo
Writing RES to file: xifu.res

In this case, an RSP file is provided, which should contain the effective area already. The program issues a warning, because usually also separate arf files are provided. This warning cautions the user to not apply the effective area correction twice.

The output spectrum is obviously wrong with a constant count rate across the entire band. The idea is to set up a new model in SPEX and simulate a new spectrum with this response matrix to replace the dummy spectrum with something more realistic.

Command-line arguments

See full documentation at: https://spex-xray.github.io/pyspextools

usage: simres [-h] --rmffile RMFFILE [--bkgfile BKGFILE] [--arffile ARFFILE] --spofile SPOFILE --resfile RESFILE [--keep-badchannels] [--overwrite]
              [--no-exprate] [--backscale BACKSCALE] [--no-color] [--version]

Named Arguments

--rmffile

Input Response matrix (required)

--bkgfile

Input Background spectrum

--arffile

Input Effective area file

--spofile

Output SPEX spectrum file (.spo, required)

--resfile

Output SPEX response file (.res, required)

--keep-badchannels

Do not remove bad channels.

Default: True

--overwrite

Overwrite existing spo and res files with same name.

Default: False

--no-exprate

Do not write additional Exp_Rate column (SPEX <=3.04.00).

Default: True

--backscale

Set a background scaling factor.

Default: 1.0

--no-color

Suppress color output.

Default: True

--version

show program’s version number and exit