We need to be able to make use of OM and AOCS attitude information to create GTIs. These GTIs may be based upon the presence of AOCS or OM data, the quality of these data, offsets of the attitude data from the average pointing, or differences between the AHF and OM data.
The task atthkgen produces a FITS file with a single bintable extension containing the entire attitude information for a complete observation, by accessing the particular ODF in question. The task tabgtigen can then be used to create GTIs from this file.
Once the whereabouts of the particular ODF in question are known, (set via the environment variable $SAS_ODF) the observation start and end times are read in by atthkgen via an OAL call. The task atthkgen then loops through every second, say (or whatever the user defines via the parameter timestep), of the observation, obtaining the attitude information and quality for this time. The task accesses the attitude data from both the Attitude History File (AHF) and from the OM Tracking History Data files (THF).
The attitude information at the requested point in time is computed by an OAL call. If the closest AHF or OM THF points lie further than 20 seconds away from the requested point in time, the attitude quality is deemed bad and the RA, Dec and position angle are set by the OAL call to bad.
The file will contain (per second, say) the following columns: firstly, along with the time (column name TIME), the AHF and OM attitude information (i.e. RA, Dec, position angle - AHFRA, AHFDEC, AHFPA, and OMRA, OMDEC, OMPA). Here, NULL values (i.e. `INDEF' in field) in all three fields will indicate that the quality is bad, hence quality filtering can be done by tabgtigen (by searching for these NULL values) to create attitude quality GTI files. If the attitude quality is good, then the absolute pointing difference between the AHF instantaneous star-tracker pointing and the previously calculated median value of the star-tracker pointing is given as DAHFPNT. Similarly the OM equivalent (DOMPNT) is given and the difference between the AHF and OM pointings (DAHFOM) (in the cases where the quality is bad, NULL values (`INDEF') are given).
Also included as attributes in the primary header will be the mean and median values of the nine tabulated attitude columns. These will be named AAHFRA, AAHFDEC etc (the `A' indicating average [i.e. mean]) and MAHFRA, MAHFDEC etc (the `M' indicating median). These values can be accessed by the task attcalc.