SYNOPSIS

funmerge [\-w|\-x] \-f [colname] <iname1> <iname2> ... <oname>

OPTIONS

  -f    # output a column specifying file from which this event came
  -w    # adjust position values using WCS info
  -x    # adjust position values using WCS info and save old values

DESCRIPTION

funmerge merges \s-1FITS\s0 data from one or more \s-1FITS\s0 Binary Table files or raw event files.

The first argument to the program specifies the first input \s-1FITS\s0 table or raw event file. If \*(L"stdin\*(R" is specified, data are read from the standard input. Use Funtools Bracket Notation to specify \s-1FITS\s0 extensions and row filters. Subsequent arguments specify additional event files and tables to merge. (\s-1NB:\s0 Stdin cannot not be used for any of these additional input file arguments.) The last argument is the output \s-1FITS\s0 file. The columns in each input table must be identical.

If an input file begins with the '@' character, it is processed as an include file, i.e., as a text file containing event file names (as well as blank lines and/or comment lines starting with the '#' sign). If standard input is specified as an include file ('@stdin'), then file names are read from the standard input until \s-1EOF\s0 (^D). Event files and include files can be mixed on a command line.

Rows from each table are written sequentially to the output file. If the switch \-f [colname] is specified on the command line, an additional column is added to each row containing the number of the file from which that row was taken (starting from one). In this case, the corresponding file names are stored in the header parameters having the prefix \s-1FUNFIL\s0, i.e., \s-1FUNFIL01\s0, \s-1FUNFIL02\s0, etc.

Using the \-w switch (or \-x switch as described below), funmerge also can adjust the position column values using the \s-1WCS\s0 information in each file. (By position columns, we mean the columns that the table is binned on, i.e., those columns defined by the bincols= switch, or (X,Y) by default.) To perform \s-1WCS\s0 alignment, the \s-1WCS\s0 of the first file is taken as the base \s-1WCS\s0. Each position in subsequent files is adjusted by first converting it to the sky coordinate in its own \s-1WCS\s0 coordinate system, then by converting this sky position to the sky position of the base \s-1WCS\s0, and finally converting back to a pixel position in the base system. Note that in order to perform \s-1WCS\s0 alignment, the appropriate \s-1WCS\s0 and \s-1TLMIN/TLMAX\s0 keywords must already exist in each \s-1FITS\s0 file.

When performing \s-1WCS\s0 alignment, you can save the original positions in the output file by using the \-x (for \*(L"xtra\*(R") switch instead of the \-w switch (i.e., using this switch also implies using \-w) The old positions are saved in columns having the same name as the original positional columns, with the added prefix \*(L"\s-1OLD_\s0\*(R".

Examples:

Merge two tables, and preserve the originating file number for each row in the column called \*(L"\s-1FILE\s0\*(R" (along with the corresponding file name in the header):

[sh] funmerge -f "FILE" test.ev test2.ev merge.ev

Merge two tables with \s-1WCS\s0 alignment, saving the old position values in 2 additional columns:

[sh] funmerge -x test.ev test2.ev merge.ev

This program only works on raw event files and binary tables. We have not yet implemented image and array merging.

RELATED TO funmerge…

See funtools(7) for a list of Funtools help pages