NAME

ahmodhkext - Merge the extensions of a FITS file together into a single extension

USAGE

ahmodhkext infile outfile keyword

DESCRIPTION

The ahmodhkext Perl script merges several extensions of a FITS file into a single extension. The merged extension is then appended to the end of the FITS file specified by 'outfile' (can be the same as 'infile'). In addition to merging, rows in the new extension are sorted based on the value of the column specified in the parameter 'sortcol'.

An additional column is created in the merged extension. This column is named from the parameter 'colname'. If 'colname' is empty, the column will have the same name as the FITS keyword specified by the parameter 'keyword'. The column is populated with the value of this keyword from the extension from which the row was originally taken. This column is added to every source extension.

Assumptions

Each extension in the input FITS file must have identical column formats and must contain an identical keyword that is in all extensions.

PARAMETERS

infile [filename]
Input file containing multiple extensions to be merged into one extension.

outfile [filename]
Name of desired output file. If this is the same as 'infile' and if 'clobber=yes', the input file will be overwritten.

keyword [string]
The 'keyword' parameter in each extension to be used to label data from that extension, using a new column in the merged extension of the new file. This keyword must be present in all extensions to be merged. If the parameter 'colname' is empty, the keyword name is used to name the new column in the merged extension. The values of this keyword populate the rows in the new column of the merged table.

(colname) [string]
Name of the new column in the merged extension. If empty, the column is named with the FITS keyword specified by the parameter 'keyword'.

(inputext = *) [string]
Comma-separated list of names of the extensions to process and merge. All extensions may be selected by using the asterisk (*).

(outputext = TARGX) [string]
Name of the new extension containing the merged data.

(valuecol) [string]
A list of values with which to populate the new column in the merged extension. There must be one entry for each respective source extension. If this parameter is specified, the new column is not populated with data from the 'keyword' parameter.

(tform = A) [string L|A|X|B|I|J|K|E|D|C|M]
Format of the column to be created.
L = logical; A = character string, X = on/off bits; B = unsigned 8-bit byte; I = 16-bit integer; J = 32-bit integer; K = 64-bit integer; E = single precision floating point; D = double precision floating point; C = single precision complex value; M = double precision complex value.

(sortcol = S_TIME) [string]
Name of column on which to sort the resulting FITS file.

(cleanup = yes) [boolean yes|no]
Delete temporary files.

(deletekey = yes) [boolean yes|no]
If 'deletekey=yes', remove the keyword specified in the 'keyword' parameter from each source extension.

(clobber = no) [boolean yes|no]
Overwrites the existing output file if set to yes.

(chatter = 1) [integer 0|1|2|3]
Chatter level for output. Set to 0 to suppress output, or to 1, 2, or 3 for increasing the chatter of the output.

(logfile = !DEFAULT) [string DEFAULT|NONE|file name]
Log file name. If set to DEFAULT, uses the name of the task and, if preceded by "!", overwrites the file if it exists. If set to NONE, no log file is created.

(debug = no) [boolean yes|no]
Diagnostic output is printed to the screen if set to yes.

(history = yes) [boolean yes|no]
Records task parameters in HISTORY.

EXAMPLES

  1. Merge two extensions of a file into one extension. Each extension contains a common keyword, TESTKEY. The value of the TESTKEY keyword in each extension is copied into a column named TESTKEY in the new merged extension. The merged extension is named TARGETEXT. The keyword TESTKEY is not deleted in the source extensions, although it is moved to the end of each header.
       ahmodhkext in.fits out.fits inputext="EXT2,EXT3" outputext=TARGETEXT keyword=TESTKEY deletekey=no
    
  2. Merge two extensions of a file into one. The merged extension is named TARGETEXT. The new column is named NEWCOLUMN. In NEWCOLUMN, every row from EXT2 will have the value "aa" and every row that came from EXT3, will have the value "bb".
       ahmodhkext in.fits out.fits inputext="EXT2,EXT3" outputext=TARGETEXT colname=NEWCOLUMN valuecol="aa,bb"
    

LAST MODIFIED

May 30, 2023