This Perl script creates a FITS file with one or more extensions from a set of text files containing the data and the table definitions. The FITS file may have multiple extensions. This script uses the ftool ftcreate to create the output FITS file.
data.dat column_def.txt header.txt
The files must be in the same format as specified in the help for ftcreate.
The column definition file specifies the name of each column in the data file, and its data type. For example:
PAR 2A
COEF0 1E
COEF1 1E
COEF2 1E
COEF3 1E
For each row in the column definition file, there is a corresponding column in the data file. For example:
P0 1.6419760E+00 6.9057592E-04 -2.8387581E-03 -1.5602625E-05
P1 2.7251086E+00 4.8774816E-03 -2.9882593E-03 -7.2517512E-05
P2 1.3079076E+00 1.1485046E-03 -2.9651825E-03 1.1986124E-04
P3 3.2381654E-01 3.2554791E-04 -2.2113894E-03 8.9718503E-07
The header file contains the keyword name, the keyword value, and the keyword description. For example:
EXTNAME 'PSF_COEF' / Name of this binary table extension
TELESCOP 'SWIFT ' / Telescope (mission) name
INSTRUME 'XRT ' / Instrument name
ahfilecaldb in.txt out.fitsThe file in.txt contains:
input/data_psf.txt input/dd_psf.txt input/head_psf.txt input/data_2.txt input/dd_psf.txt input/head_psf.txt