Good Time Intervals (GTI) are defined as pairs of START and STOP times that enclose periods of time on which to base data selection. GTI tables can also contain additional columns with attributes assoicated with each START/STOP pair. In a FITS file, the additional attributes are represented in additional columns in the same GTI extension.
The gticolconv task has two conversion functions:
If the 'direction' parameter is set to SPLIT, gticolconv checks that the GTI extension in the input file contains three columns: START, STOP, and a column whose name 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. Each unique value is written to a header keyword in the corresponding extension. The name of this keyword is specified in the input parameter 'keyname'. The value of the keyword 'keyname' in each extension is based on the input parameter 'keyform', which is a string that ends in a number of "#" characters. A common root for all values of 'keyname' is obtained by taking the part of the string preceeding the "#" characters, and the remainder of the value of 'keyname' for a given extension. The common root is formed by the script by replacing the "#" characters with the entries in 'column' corresponding to that extension. Similarly, the extension name is set by appending the 'keyname' values thus derived, to the string 'GTI'. For example, suppose 'keyname=DETNAM', 'keyform=PIX##', and that the 3rd column in the input file is called PIXEL. Then, the GTI extension formed from all rows with PIXEL=1, will have a name GTIPIX01, and that extension will have a header keyword DETNAM, whose value is PIX01. In each extension, the TSTART and TSTOP keyword values are taken from the earliest and latest times in the GTI extension respectively.
If 'direction=MERGE', gticolconv merges several GTI extensions in the input file into a single GTI extension in the output file. Each GTI extension in the input file contains two columns (START and STOP), and the merged GTI extension in the output file will contain three columns (START, STOP, and a column named by the value of the 'column' parameter). Each input GTI extension header is searched for a keyword specified by the parameter 'keyname', with a pattern specified in the parameter 'keyform'. The gticolconv task extracts a unique identifier for each input GTI extension from the value of 'keyname' by removing the part of the string of 'keyform' that occurs before any "#" characters. This identifer will, for a given input GTI extension, become an entry in the new column in the merged GTI file for each row that is associated with that GTI extension. The merged extension name in the output file is formed by appending the string value of 'column' to the string 'GTI'. The integer values in the third column are taken from the numerical portion of the input GTI extension to which the START and STOP values in a particular row belong. For example, suppose that the input extensions have 'keyname=DETNAM', 'keyform=PIX##', and 'column=PIXEL'. The input extension names should be PIX01, PIX02, etc. The output extension name will be GTIPIXEL, and the third column, called PIXEL, will have values 1, 2, 3, etc. for GTI intervals that came from the corresponding input extensions PIX01, PIX02, PIX03, etc. The output file is sorted by START, STOP, and then by 'column'. The TSTART and TSTOP keyword values in the header of the merged output file are taken from the earliest and latest times in the output GTI extension respectively.
gticolconv infile="ah100041010sxs_el.gti.gz[1]" outfile=px_split.gti column=PIXEL direction=SPLIT keyname=DETNAM \ keyform="PIX##" clobber=yes
gticolconv infile=px_split.gti outfile=px_merge.gti column=PIXEL direction=MERGE keyname=DETNAM keyform="PIX##" \ clobber=yes