ahcalctime - Rerun the timing tools on an output directory from the pipeline


ahcalctime indir outdir


'ahcalctime' is a script that recalculates the TIME column in the event files and the housekeeping (HK) files. As input, the script expects a directory structure as defined for a sequence downloaded from the archive.

The data from the 'indir' directory are copied to the 'outdir'. The directory structure inside indir is the same of outdir. Only the files and directories necessary to the tools are copied over. For example, the event_uf directory is copied, but not the event_cl.

To recalculate time the script runs the following tools:

  1. Runs ahmktim on the tim file, after making a copy of the original tim file.
  2. Runs ahtime on the general HK file
  3. Runs sxssamcnt on the SXS HK file
  4. Runs sxssamcnt on each SXS unfiltered event file
  5. Runs sxssamcnt on the SXS lost GTI file
  6. Runs ahtime on the SXS lost GTI file
  7. Runs ahtime on each instrument HK file
  8. Runs ahtime on each instrument unfiltered event file


The input directory 'indir' must have the following directory structure:

  indir/auxil/general HK file, tim file

This is the same structure as is output by the pipeline that is placed in the archive.


The following directories and files are copied from the 'indir' to the 'outdir', and the new time is calculated only for these files:


If 'clobber=yes' and the 'outdir' exists, the 'outdir' is removed completely before beginning, and a new copy is made from 'indir'. If 'clobber=no' and the 'outdir' exists, the script exits with a failure. All of the individual tools operate as though 'clobber=yes'. The tools called within ahcalctime create and overwrite, for example, the existing (in the 'outdir') instrument hk file from ahtime. The files in 'indir' are untouched.

The original tim file is copied to a [base]_orig.tim, and the new tim file only keeps the primary HDU and first extension in order to recreate the second extension.

When calling the timing tools, the script creates intermediate files, then either copies them or moves them to their final destination, based on the 'cleanup' parameter.


indir [string]
Input directory

outdir [string]
Output directory.

(verify_input = no) [boolean]
Verify the input files with ftverify.

(sorttime = yes) [boolean]
Sort the output time column after calling ahtime, on the column specified in the 'timecol' parameter. All extensions are sorted on this column, if that extension contains the column and has a nonzero number of rows.

(frqtemfile = CALDB) [filename]
Used in ahmktim: the freq vs. temp file (or CALDB)

(sxs_coeftime = CALDB) [filename]
Used in sxssamcnt: Input file with arrival time coefficients (or CALDB)

(coldeffile = CALDB) [filename]
Used in ahtime: Input file with column names for the time corrections (or CALDB)

(delayfile = CALDB) [filename]
Used in ahtime: Input instrument delay file (or CALDB)

(offsetfile = CALDB) [filename]
Used in ahtime: Input file with the CAMS offset corrections (or CALDB)

(leapsecfile = REFDATA) [filename]
Used in ahmktim, ahtime: Input leap second file (or CALDB, [REFDATA])

(timext = TIM_LOOKUP) [string]
Used in ahmktim: Output TIM extension created by the ahmktim tool.

(gaptime = 2.0) [real]
Used in ahmktim: Minimum time [s] to define a gap

(timecol = TIME) [string]
Used in ahtime: Output time column

(gticolumns = START) [string]
Used in ahtime: Output GTI column names

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

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

(chatter = 1) [integer]
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]
Log filename. If set to DEFAULT uses the name of the task and, if preceded by '!', overwrite the file if it exists. If set to NONE no log file is created.

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

(history = yes) [boolean]
Records tool parameters in HISTORY ([yes]/no).

(mode = ql) [string ql|hl|q]
Mode to query the parameter file. Acceptable values include: "ql (query and learn/remember), "hl" (hidden and learn/remember), "q" (query but don't remember), "h" (hidden).(Optional)


  1.         ahcalctime indir outdir
    The script copies the necessary files from indir to outdir, then recalculates the time columns on the files in outdir.



March 2016