'ahtime' is a general mission task that assignes times to all science and HK data files. By default the
calculated times are written in the column TIME (see parameter 'timecol') for science and HK data file and in the
columns START and STOP for GTI files. Only for the HK files the times are also written as an UTC time in
the columns YYYY, DDD, HH, MM, SS, US.
The time calculation always requires the following supporting input files: a) the tim file (parameter 'timfile')
containing the conversion TIME vs TI; b) the CALDB column definition file (parameter 'coldeffile') containing
the columns names appropriate for the instrument; and c) the leap seconds file (parameter 'leapsec').
All science data also require the CALDB delay file (parameter 'delayfile') containing the delay added last
to the calculated time. The SGD, HXI , SXS science data also require a look-up table stored
in the instrument specific HK extension for fine time assignment. The delay file and the HK look-up table are
not required when calculating the times for the HK file, but for the HXI and SGD.
For the CAMS it is also necessary a CALDB file containing the offsets of the individual measurements relative to a time stamp.
The frame work to assign time is based on a three-steps process using two different look-up tables. For the
SGD, HXI and SXS science, 'ahtime' first derives the fine time, in unit of L32TI, using a look-up table
in the instrument HK (step 1). The fine time is assigned internally by the instrument processor.
Afterwards 'ahtime' derives the time using the look-up table in the TIM files providing the TI vs TIME relation (step 2).
Last it adds, when appropriate, a delay time between the on board computer and the instrument (step 3).
For HK data, step 1 and 3 are skipped because there is not need of fine time assignment. The exceptions are
the CAMS and MXS HK where a delay time is added to the times (step 3).
For the SXI science the step 1 is skipped because the event data has already fine time information included,
but calculates the times considering the DATAMODE (if WINDOW1 or WINDOW2 or WINDOW1BURST and/or WINDOW2BURST) and
requires the several keywords to be present in the event file (TIMEDEL, TIMTRANB, EXPDEADB, TIMTRANA, EXPDEADA,
FLUSHIMB, LASTDEAD, LASTDEL, NOMEXPO, TIMEPIXR).
'ahtime' updates the following header keywords TSTART, TSTOP, DATE-OBS, DATE-END in the extension and in the primary
that correspond to the smaller and largest values of the TIME column. If the file contains more than one
extension as for the case of the HK, 'ahtime' calculates time in all extensions. The header keywords , in this case,
are updated as follows: the primary header TSTART and STOP correspond to the lowest start and the largest stop
considering all the extensions , while in each extension the TSTART and TSTOP are based on the smaller and largest
time in the TIME column of the extension. The TIME column output from 'ahtime' is not time ordered.
1. Calculate times for an HK file, infile.hk using the tim file infile,tim. For HK the 'lookupfile' is set to NONE
ahtime infile.hk outfile.hk infile.tim NONE2. Calculating times for a SXS science event file, infile.evt, using the tim file infile,tim. The SXS event requires a 'lookupfile' set to sxsinfile.hk
ahtime sxsinfile.evt outfile.hk infile.tim sxsinfile.hk