NAME

gticolconv -- convert GTI file from one extension to multiple extension based on a column value and viceversa

USAGE

gticolconv infile outfile column direction keyname keyform

DESCRIPTION

Good Time Interval are defined as file containing START and STOP columns. However if the START and STOP varies with a fix number of elements, a compact format includes beside the START and STOP columns an additional column (hereafter name ELEMENT) containing the element values associate to the appropriate start and stop values. 'gticolconv' has two convertion functions: 1) Split a Good Time Interval (GTI) file containing START STOP and ELEMENT columns into a file containing several extension as many as the unique values in the column ELEMENT .
2) Merge several GTI extensions into a single extension with three columns STATOP STOP and ELEMENT where ELEMENT is populated with a unique value as many as GTI extensions are present.

If the 'direction' parameter is set to SPLIT,'gticolconv' checks that the GTI extension in the file contains three columns : the columns named START, STOP and the column which named is specified in the parameter 'column'. The script first calculates the unique values in 'column' and then creates a new GTI extension for each value found in the original input GTI file. The unique value is written in an header keyword specified in the parameter 'keyname'. The format of the value written in 'keyname' is specified in the parameter 'keyform' . The 'keyform' should be specified with a string followed by #s. The script replaces any #'s with the value from the 'column' associated to the GTI specific extension. Similarly, the extension name is set as GTI'keyform' with #'s replaced with column values. The TSTART and TSTOP for each extension are calculated based on the first row START value and last row STOP value for each extension.

If 'direction' is set to MERGE, 'gticolconv' expects a file with several GTI extensions, each containing two columns (START and STOP) and an header keyword specified in the parameter 'keyname' with a pattern specified in the parameter 'keyform'. 'gticolconv' searches for 'keyname' in all GTI extensions and read the # of the 'keyform' to construct the unique values that populate the columns specified in the parameter 'column'. All extension are merged into a single-extension GTI file with the columns START, STOP and 'column'. The merged extension is named "GTI'column" and the content of the keyword 'keyname' is set as the value in the parameter 'column'. The output file is sorted by START, STOP and then by 'column'. TSTART and TSTOP are calculated based on the first row START value and last row STOP value.

PARAMETERS

infile [file]
Input GTI file. This file may either contain several GTI extensions or one GTI extension.

outfile [file]
Output GTI file

column [string]
Column name. If the 'direction is split the 'column' parameter is the name of the column in the GTI extension use to split the start and stop in several extensions. If the 'direction' is merge the parameter 'column' is used to name the column containing the values of the elements associated to the start and stop as well as to name the extension and the content of the keyword defined by the parameter 'keyname'

direction [string]
Split GTI or Merge GTI based

keyname [string]
Keyword to read/set output column. If the direction is merge, the input file is search for all the GTI extensions that have in the header the keyword 'keyname'. If the direction is split, the keyword 'keyname' is filled with the parameter value 'column'.

keyform [string]
Formatting to read/set for splitting. The content is a string followed by #s. Example PIXEL##

(cleanup = yes) [bool]
Delete temporary files ([yes]/no)

(clobber = no) [bool]
Overwrite existing output file ([yes]/no)

(chatter = 2) [int]
Chatter level for output

(logfile = !DEFAULT) [string]
Output log file (DEFAULT, NONE; '!' to clobber)

(debug = no) [bool]
Enable debug mode ([yes]/no)

(history = yes) [bool]
Record tool parameters in HISTORY ([yes]/no)

(mode = ql) [string]
Mode of automatic parameters

EXAMPLES

    Splitting a file:
    gticolconv ah100041010sxs_el.gti.gz[1] px_split.gti PIXEL SPLIT DETNAM PIX## clobber=yes
    Merging a file:
    gticolconv px_split.gti px_merge.gti PIXEL merge DETNAM PIX## clobber=yes

SEE ALSO

ftcopy ftmerge

LAST MODIFIED

August 2016