NAME

sxssamcnt - Calculate the local time in the SXS files necessary to assign time

USAGE

sxssamcnt infile outfile

DESCRIPTION

'sxssamcnt' calculates the 'local time' and fills the column(s) SAMPLECNT(#) in the SXS event, lost GTI and HK files. Sample count represents the fine time resolution, assigned internally by the instrument electronics. After 'sxssamcnt' is run, the task 'ahtime' synchronizes the fine local time to the TT time (obtained via the GPS) written in the TIME column. 'sxssamcnt' runs : on science antico and pixel event files; on the diagnostic mode wfrb and noiserec for antico and pixel data and pulserec for the pixel data; on the gti lost for antico and pixel and on specific extensions of the HK data. The calculation of the samplecnt uses different columns depending on the input data type. a) For all type of events detected by the pixel array the columns are: TRIG_LP, rough event trigger time, TIME_VERNIER, fine time correction, WFRB_WRITE_LP, reference for the TRIG_LP and WFRB_SAMPLE_CNT, reference for the sample cnt. b) For the antico events the columns are : TRIG_LP, WFRB_WRITE_LP, WFRB_SAMPLE_CNT, FLG_EVENT_LOST. c) For the HK the columns are : LATCH_SAMPLE_CNT1, reference to the sample count and LATCH_BASE_CNT1, finer clock value. d) For the lost GTI the columns are : EL_#_LP, TRIG_LP for the start and stop, WFRB_WRITE_LP and WFRB_SAMPLE_CNT. These column names may be set in the parameters 'col1', 'col2', 'col3', 'col4' and 'col5' depending on the input data file.
The sample count calculation is written in the column(s) set by the parameter 'outcol'. For antico and HK, 'sxssamcnt' always calculates single value per each row that is written in the output column SAMPLECNT. For lost GTI, 'sxssamcnt' calculates two values for each row that are written in the columns SAMPLECNT1 and SAMPLECNT2. These are used by 'ahtime' to calculate the START and STOP. For the pixel data, the task also calculates two local times for each row. The first, SAMPLECNTTRIG, is derived similarly to the other local time and is to enable the calculation of the event trigger time by 'ahtime'. The other, SAMPLECNT, is derived with a polynomial function of SAMPLECNTTRIG, whose coefficient are stored in CALDB, and is to enable the calculation of the event arrival time.

PARAMETERS

infile [filename]
Name of input SXS file. 'sxssamcnt' may be used on event (pixel and antico), some diagnostic science event mode SXS-specific HK, or lost GTI input files.

outfile [filename]
Name of the output file that contains the calculated sample count column(s). For antico and HK only one column SAMPLECNT is written; for lost GTI two columns are written SAMPLECNT1 and SAMPLECNT2 ; for pixel event two columns are written SAMPLECNTTRIG and SAMPLECNT.

(col1 = DEFAULT) [string]
Column name for the rough local time. If col1=DEFAULT, this is set to TRIG_LP for pixel, antico, pulserec and noiserec event files, to LATCH_Sample_Cnt1 for SXS-specific HK extension, to EL_#_LP for lost GTI, where '#' indicates that both start and stop times are processed.

(col2 = DEFAULT) [string]
Column name for the 'fine' local time correction. If col2=DEFAULT, this is set to TIME_VERNIER for pixel and pulserec event files, to LATCH_base_Cnt1 for SXS-specific HK extension. For the antico, noiserec and lost GTI files this column is ignored. For antico and lost GTI files TIME_VERNIER is set by the values in the parameters 'timever1' and 'timever2'.

(col3 = DEFAULT) [string]
Column name for the reference rough local time. If col3=DEFAULT, this is set to WFRB_WRITE_LP for pixel, antico, pulserec, noiserec and lost GTI files. For SXS-specific HK extension is ignored.

(col4 = DEFAULT) [string]
Column name for the reference sample count. If col4=DEFAULT, this is set to WFRB_SAMPLE_CNT for pixel, antico, pulserec, noiserec and lost GTI files. For SXS-specific HK extension is ignored.

(col5 = DEFAULT) [string]
Column name that specifies whether an antico event is a 'lost antico event'. If col5=DEFAULT, this is set to FLG_EVENT_LOST, and the SAMPLECNT column is set to its NULL value.

(timever1 = 1) [integer]
Time to be added to the local time calculation. For lost GTI files this value is added to the sample count corresponding to the start. For antico events this value is added to the SAMPLECNT column Default values are -8 for antico lost GTI, 0 for antico events.

(timever2 = 2) [integer]
Time to be added to the local time calculation. For lost GTI files this value is added to the sample count corresponding to the stop. Default value is 23 for antico lost GTI.

(outcol = DEFAULT) [string]
Output column name for the calculated local time. If set to DEFAULT, the name is SAMPLECNT for antico, pulserec and noiserec files, and SXS-specific HK extensions. For lost GTI files, by default the columns are SAMPLECNT1 and SAMPLECNT2 else add to '1' and '2' to the string in 'outcol'. For pixel event, by default the columns are SAMPLECNT and SAMPLECNTTRIG.

(buffer = -1) [integer]
Rows to buffer (-1=auto, 0=none, >0=numrows).

(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).

EXAMPLES

1. Calculate the samplecnt for the SXS housekeeping (HK) file hk_in.fits, creating the output HK file hk_out.fits with the SAMPLECNT column populated accordingly, and using the values in the LATCH_SAMPLE_CNT1 and LATCH_BASE_CNT1 columns for the calculation.

      sxssamcnt hk_in.fits hk_out.fits 

2. Calculate the samplecnt for the SXS pixel event file event_in.fits, creating the output event file event_out.fits with the SAMPLECNT column populated accordingly, and using the values in the WFRB_SAMPLE_CNT, WFRB_WRITE_LP, TRIG_LP, TIME_VERNIER columns for the calculation.

      sxssamcnt event_in.fits event_out.fits 

3. Calculate the samplecnt for the SXS antico event file antico_in.fits, creating the output event file antico_out.fits with the SAMPLECNT column populated accordingly, using the values in the WFRB_SAMPLE_CNT, WFRB_WRITE_LP, and TRIG_LP columns for the calculation.

      sxssamcnt antico_in.fits antico_out.fits 

4. Calculate the start and stop samplecnt values the LOST gti file lost_in.gti, creating the output event file lost_out.gti with the SAMPLECNT1 and column SAMPLECNT2 populated accordingly, using the values in the WFRB_SAMPLE_CNT, WFRB_WRITE_LP, and TRIG_LP columns for the calculation. Extend each interval so that they extend 8 ticks earlier and 15 ticks later.

      sxssamcnt lost_in.gti lost_out.gti timever1=-8 timever2=15

SEE ALSO

ahtime

LAST MODIFIED

February 2, 2016