gtmktime Help File


Create Good Time Intervals (GTIs) based on selections made on the spacecraft data file variables.

Usage: gtmktime scfile filter roicut evfile outfile

gtmktime is used to update the Good Time Intervals (GTI) extension and make cuts based on spacecraft parameters contained in the Pointing and Livetime History (i.e., FT2 spacecraft) FITS file.

A Good Time Interval is a time range when the data can be considered valid. The GTI extension contains a list of these GTIs for the file. The sum of the entries in the GTI extension of a file corresponds to the time when the data in the file is "good". In the case of the LAT data, the GTIs are the list of times that the LAT was collecting data over the time range you selected. The Science Analysis Environment (SAE) tools use the GTIs for the exposure calculation.


  • Your object will most likely not be in the field of view during the entire time that the LAT was taking data.
  • Additional data cuts made with gtmktime will update the GTI's based on the cuts specified in both gtmktime and gtselect.
  • The Science Tools use the GTI's when calculating exposure. If these have not been properly updated, the exposure correction made during science analysis may be incorrect.

The gtmktime tool reads the spacecraft data file and, based on specified cuts, creates a set of GTIs. These are then combined (logical and) with the existing GTIs in the event file, and all events outside this new set of GTI are removed from the file. New GTIs are then written to the GTI extension of the new file. The gtmktime tool is most commonly applied to event data; and, by default, the event data will be filtered according to the GTIs that are created. This
tool may also be used to update GTIs in other tabular files such as those created by gtltcube.

Cuts can be made on any field in the spacecraft data file. The default is to select times when the spacecraft is not in the Southern Atlantic Anomaly (SAA), i.e. "IN_SAA!=T". Cuts are made using C-style relational syntax; for example:

! (not), && (and), || (or), != (different), >, <, >=, <=,
abs(), cos(), sin(),

Note: Every time you specify an additional cut on time, ROI, zenith angle, or event class using gtselect, you must run gtmktime to reevaluate the GTI selection.

Several of the cuts made above with gtselect will directly affect the exposure. gtmktime will select the correct GTIs to handle these cuts, including the complex cut on zenith angle. The easy way to implement this cut is to exclude time intervals where the buffer zone defined by the zenith cut intersects the ROI from the list of GTIs. In order to do that, run gtmktime and answer "yes" at the prompt:

Apply ROI-based zenith angle cut [ ] yes

Applying this cut is especially important if your ROI is small (< 20 degrees), bringing your source of interest close to the Earth's limb.

Note: If you are studing a very broad region (or the whole sky) you would lose most (all) of your data when you implement the zenith angle cut. In this case you can allow all time intervals where the cut intersects the ROI, but the intersection lies outside the FOV. To do this, run gtmktime specifying a filter expression defining your analysis region, and answer "no" to the question regarding the ROI-based zenith angle cut:

Filter expression [ ] ( ANGSEP(RA_ZENITH,DEC_ZENITH,RA_SCZ,DEC_SCZ) < limb_angle_minus_FOV ) || ( ANGSEP(RA_ZENITH,DEC_ZENITH,RA_of_center_ROI,DEC_of_center_ROI) + radius_ROI < zenith_cut )
Apply ROI-based zenith angle cut [ ] no

Here, RA_of_center_ROI, DEC_of_center_ROI and radius_ROI correspond to the ROI selection made with gtselect, zenith_cut is defined as 105 degrees (as above), and limb_angle_minus_FOV is (zenith angle of horizon - FOV radius) where the zenith angle of the horizon is 113 degrees.

gtmktime also provides the ability to exclude periods when some event has negatively affected the quality of the LAT data. To do this, we select good time intervals (GTIs) by using a logical filter for any of the quantities in the spacecraft file. Some possible quantities for filtering data are:

  • DATA_QUAL - quality flag set by the LAT instrument team (0 = bad, 1 = ok)
  • LAT_CONFIG - instrument configuration (0 = not recommended for analysis, 1 = science configuration)
  • ROCK_ANGLE - can be used to eliminate pointed observations from the dataset.

Note: A history of the rocking profiles that have been used by the LAT can be found in the LAT All-Sky Survey Observations.

The current gtmktime filter expression recommended by the LAT team is:


Here it is an example of running gtmktime on the 3C 279 filtered events file. It is useful to rename the spacecraft file to something easier. Here, we have renamed L100806104523E0D2F37E54_SC00.fits to spacecraft.fits.

prompt> gtmktime
Spacecraft data file[] spacecraft.fits
Filter expression[] DATA_QUAL==1 && LAT_CONFIG==1 && ABS(ROCK_ANGLE)<52
Apply ROI-based zenith angle cut[yes]
Event data file[] 3C279_region_filtered.fits
Output event file name[] 3C279_region_filtered_gti.fits

After the data preparation it is advisable to take a look at your data before beginning the detailed analysis. The Explore LAT Data tutorial has suggestions on method of getting a quick preview of your data.

Other kinds of cuts on the data could be made using the gtselect tool. See the gtselect documentation for further explanation.

Example: gtmktime

Parameters are passed following the FTOOLs model (i.e., they can be passed interactively by: answering a prompt; as a list in a command line; or by editing the parameter file). To be prompted for gtmktime parameter values, enter (at the command line): gtmktime

Note: "Hidden" parameters are not prompted. If you want to change one of the "hidden" parameters, specify the values in the command line. For example, if you do not want to overwrite the output file, set the clobber parameter "clobber=no" ( e.g., gtmktime clobber=no).

In the following example the _3C279_3C273_back_events_0000.fits data file is used, along with the spacecraft data file called FT2.fits. All events that fall in time ranges outside of the SAA are selected out:

> gtmktime
Spacecraft data file [test_scData_0000.fits] : FT2.fits
Filter expression [IN_SAA!=T] :
Event data file [test_events_0000.fits] : _3C279_3C273_back_events_0000.fits
Output event file name [filtered.fits] : _3C279_3C273_back_filtered.fits

The output event FITS file is called: _3C279_3C273_back_filtered.fits.

The same example can be run in the command line as follows:

gtmktime scfile=FT2.fits filter=IN_SAA!=T

Owned by: J. Chiang

Last updated by: Chuck Patterson 02/10/2011