NAME

ftflx2tab - Read an input text file with one or more model spectra and convert to an XSPEC table model file.

USAGE

ftflx2tab infile modelname outfile nspec parinfofile additive redshift xunit yunit clobber

DESCRIPTION

This tool reads a text file (infile) containing one or more spectra and converts them into an XSPEC table model file (outfile) so they can be used as a model to fit to data. The input text file should have one line for each bin of the spectrum. Each line should have at least three numbers. The first two should be the start and end energy (or wavelength) of the bin and the third the flux. If multiple spectra are to be read then the flux for the second spectrum will be the fourth number 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 numbers per line.

If multiple spectra are read then an additional input text file (parinfofile) is required to describe the model parameter information and values for which the input spectra were calculated. This text file should be as follows: the first line contains the parameter name; the second line should be 0 (for linear interpolation) or 1 (for log interpolation); the third line contains the six numbers for parameter start value, delta, low, bottom, top, high (these are the numbers shown by eg the XSPEC newpar command); the last line contains the nspec parameter values used to generate the tabulated spectra.

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 model spectrum or spectra.

modelname [string]
The name which will be used in XSPEC for the model.

outfile [filename]
The name of the output XSPEC table model file.

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

parinfofile [filename]
The name of the text file containing information on the parameter. This is only required if nspec is greater than 1.

additive [bool]
If additive = yes then the table model is additive, if not it is multiplicative.

redshift [bool]
If redshift = yes then the table model will include a redshift parameter.

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. This is not used if the model is multiplicative. 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.

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

EXAMPLES

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

ftflx2tab myinput.txt MyModel mytable.fits

2. Suppose we have a model with a single parameter, alpha, and we calculate spectra for alpha values of 1, 2, 3, 4, 5. We create the input text file as in the previous example except there are now five columns of fluxes. We also create a parameter information file, myparfile.txt :

alpha
0
3.0 0.1 1.0 1.0 5.0 5.0
1.0 2.0 3.0 4.0 5.0
and make the table model file by :

ftflx2tab myinput.txt MyModel mytable.fits nspec=5 parinfofile=myparfile.txt

If we want to have XSPEC add a redshift parameter for the model then we make the table model file by :

ftflx2tab myinput.txt MyModel mytable.fits nspec=5 parinfofile=myparfile.txt redshift=yes

3. As the previous case except that our spectra are in units of ergs/cm^2/microns calculated in wavelength bins given in microns.

ftflx2tab myinput.txt MyModel mytable.fits nspec=5 parinfofile=myparfile.txt xunit=micron yunit=ergs/cm^2/um redshift=yes

SEE ALSO

XSPEC atable and mtable commands. The file format for XSPEC table models.

LAST MODIFIED

Oct 2012