NAME

ftflx2xsp - Creates spectra and response files from an input text file of fluxes and errors.

USAGE

ftflx2xsp infile phafile rspfile xunit yunit first clobber

DESCRIPTION

This tool reads a text file (infile) containing one or more spectra and errors and writes out a standard PHA file (phafile) and RSP file (rspfile) which can be used in XSPEC. The response file created is a unit diagonal matrix of the appropriate size. The input text file should have one line for each bin of the spectrum. Each line should have at least four numbers. The first two should be the start and end energy (or wavelength) of the bin and the second two the flux and one sigma error. If multiple spectra are to be read then the flux and error for the second spectrum will be the fifth and sixth numbers and so forth. The bins must be contiguous i.e. the end energy (or wavelength) of one bin must be the same as the start energy (or wavelength) as the next. The nspec parameter is used to specify the number of spectra to read so the text file should have nspec*2+2 numbers per line.

The units for the energies (or wavelengths) and fluxes in the input text file can be specified using the xunit and yunit parameters. The allowed units are given below in the parameter specifications.

PARAMETERS

infile [filename]
The name of the input text file with the spectrum or spectra and errors.

phafile [filename]
The name of the output PHA file.

rspfile [filename]
The name of the output RSP file. This will be a diagonal response.

nspec [int]
The number of spectra in the input text file.

xunit [string]
The units for energy or wavelength used in the input text file. The allowed options are keV (the default), MeV, GeV, Hz, angstrom, cm, micron, or nm.

yunit [string]
The units for flux used in the input text file. The allowed options are ph/cm^2/s (the default), ph/cm^2/s/MeV, ph/cm^2/s/GeV, ph/cm^2/s/Hz, ph/cm^2/s/A, ph/cm^2/s/cm, ph/cm^2/s/um, ph/cm^2/s/nm, ergs/cm^2/s, ergs/cm^2/s/Hz, ergs/cm^2/s/A, ergs/cm^2/s/cm, ergs/cm^2/s/um, ergs/cm^2/s/nm, or Jy.

first [int]
The number for the first channel (usually either 0 or 1).

clobber [bool]
If clobber = yes then overwrite the output files if a file of the appropriate name already exists.

EXAMPLES

1. Suppose we have a single spectrum with errors which we wish to fit in XSPEC. We create an text input file, myinput.txt :
0.1 0.2  1.3 0.1
0.2 0.3  1.4 0.1
0.3 0.4  1.8 0.1
0.4 0.5  0.9 0.1
0.5 0.6  0.8 0.1
0.6 0.7  1.0 0.1
0.7 0.8  0.5 0.1
0.8 0.9  0.3 0.1
0.9 1.0  0.1 0.1
and make the files by :

ftflx2xsp myinput.txt myspectrum.pha myresponse.rsp
2. If five sets of spectra and energies are included in the input file:

ftflx2xsp myinput.txt myspectrum.pha myresponse.rsp nspec=5 clobber=yes
3. If the input is in GeV and ergs/cm^2/s

ftflx2xsp myinput.txt myspectrum.pha myresponse.rsp nspec=5 clobber=yes xunit=GeV yunit=ergs/cm^2/s

SEE ALSO

LAST MODIFIED

Oct 2022