xrtfilter -- Run in sequence 'prefilter' and 'makefilter' to create a filter file from HK data.


xrtfilter hdfile outdir [parameter= ]


'xrtfilter' creates a filter file, containing all the housekeeping information, to be used in the data screening. This is achieved within 'xrtfilter' by running in sequence 'prefilter' and 'makefilter'.

The first step is to derive attitude and orbit related quantities through the 'prefilter' task. The satellite attitude information included in the attitude file is interpolated and the NORAD two line elements (TLEs) are propagated to determine satellite ephemeris quantities. This information is used to calculate quantities such as Bright Earth Angle, Sun Angle, Cut off rigidity, etc. The output file of 'prefilter' contains the following default columns : TIME, POSITION, VELOCITY, QUATERNION, POINTING, POLAR, BORESIGHT, SAT_ALT, SAT_LAT, SAT_LON, Z_RA, Z_DEC, Z_ROLL, ELV, BR_EARTH, FOV_FLAG, SUNSHINE, SUN_ANGLE, MOON_ANGLE, RAM_ANGLE, ANG_DIST, COR_SAX, SAA, SAA_TIME. The default output columns are stored in a CALDB file. A different set of columns can be requested by the user via an input file supplied to the program in the parameter 'outcols'. This input file is an ASCII file where column names are listed one per row. The TIME column is mandatory, other columns allowed are: POSITION, VELOCITY, QUATERNION, POINTING, POLAR, BORESIGHT, SAT_ALT, SAT_LAT, SAT_LON, Z_RA, Z_DEC, Z_ROLL, ELV, BR_EARTH, FOV_FLAG, SUNSHINE, SUN_ANGLE, MOON_ANGLE, RAM_ANGLE, ANG_DIST, COR_ASCA, COR_SAX, MCILWAIN_L, SAA, SAA_TIME.

The second step creates a filter file by running the task 'makefilter'. This uses as input the output from 'prefilter', the housekeeping file, the spacecraft housekeeping file and a configuration file. The 'makefilter' configuration file can be an ASCII file or a FITS file and must contain for each parameter requested the following information:
the parameter name, the name of the FITS file, the name of the extension containing the parameter, the interpolation method, the calibration method, the output parameter name and comments for the corresponding keyword in the output filter file. The interpolation method is used when the value of a specific parameter is not present at given times; the calibration method is applied when some simple numerical manipulations on the input HK parameters is needed. Currently, the default of the interpolation method is set to copy the last known value of that parameter. The calibration method has not been implemented yet.

The default 'makefilter' configuration file is part of CALDB and includes the following columns: ELV, BR_EARTH, COR_SAX, SAA, SAA_TIME, ANG_DIST, FOV_FLAG, DEC, MCILWAIN_L, MOON_ANGLE, RA, RAM_ANGLE, ROLL, SUNSHINE, SUN_ANGLE, CCDTemp, PixGtULD, Vod1, Vod2, Vrd1, Vrd2, Vsub, Vbackjun, Baselin1, Baselin2, SAC_ADERR, SACSTNUMSTARS, STAST_LOSSFCN, SAC_MODESTAT. In addition the task adds the columns TEN_ARCMIN, SETTLED, ACS_SAA, SAFEHOLD. These columns will be included in the output filter file. Moreover the two columns STLOCKFL and STLOCKST are calculated using information from the spacececraft housekeeping file and added to the output filter file.


hdfile [file name]
Name of the input Housekeeping Header Packets FITS file (

enfile [file name]
Name of the input Spacecraft Housekeeping Packets FITS file (used only if 'configfile' is set to 'NONE').

(nonulls=yes) [boolean]
If set to 'yes' discharges from makefilter file rows with TIME set to NULL.

outdir [file name]
Name of the directory for outputs.

(clobber=no) [boolean]
If clobber=yes overwrite the output file.

(chatter = 3) [integer]
Chatter Level (min=0, max=5).

(history=yes) [boolean]
If set to 'yes', write history keywords to the output file.

attfile [file name]
Name of the input attitude FITS file.

alignfile [file name]
Name of the input attitude alignment FITS file. Type NONE for none.

(outfile=DEFAULT) [file name]
Name of prefilter outfile. DEFAULT to use standard naming convention.

(outcols=CALDB) [file name]|[space-separated-values]
Name of prefilter configuration file including the list of parameters, related to attitude and orbit information, to be included in the 'prefilter' output file. The user can also input a list of space-separated parameters between quotes on the command line.

(orbmode=TLE_TEXT2) [string]
Specifies the orbit mode which controls how the file, input through parameter 'orbname', will be processed. See help file of the 'prefilter' task.

(orbfile=$HEADAS//refdata/SWIFT_TLE_ARCHIVE.txt) [file name]
Name of the input orbit file.

(leapfile=$HEADAS/refdata/leapsec.fits) [file name]
Name of FITS leap second file.

(rigfile=$HEADAS/refdata/ [file name]
Name of the input atFunctions rigidity file.

(origin=NASA/GSFC) [string]
Value for FITS ORIGIN keyword.

(interval=1) [real]
Output interval (seconds).

ranom [real]
Nominal right ascension (degrees).

decnom [real]
Nominal declination (degrees).

(mkfconfigfile = CALDB) [string]
Name of the input FITS makefilter configuration file. If set to CALDB, the file is taken from the calibration database.

(configfile = NONE) [string]
Name of the ASCII makefilter configuration file. Type NONE to use 'mkfconfigfile' parameter.

(hdstem=NONE) [string]
Stem of the input Housekeeping file (to be used only if 'configfile' is different from NONE).

(mkffile=DEFAULT) [file name]
Name of the output makefilter file. Type DEFAULT to use the standard name.

(gtiexpr=TIME-TIME{-1}<5.1.or.ISNULL(TIME{-1})) [string]
Expression for GTI generation on Attitude.


  1. Create the filter file 'sw00035009011s.mkf' using sw00035009011sat.fits as attitude file and as HK file. The quantities calculated by 'prefilter' are listed in a CALDB file and columns included in the output filter file are listed in myconfigure.conf. The verbosity level is set to the maximum.

    xrtfilter outdir=./ attfile=sw00035009011sat.fits 
         ranom=110.487  decnom=71.3567  configfile=myconfigure.conf  chatter=5 




May 2008