Fermi Gamma-ray Space Telescope

Observation Simulation Tutorial

This tutorial provides some step-by-step examples of how to simulate Fermi observations using the gtobssim application. For example a Guest Investigator planning a proposal may need to make a realistic assessment of the detection significance achievable within a given time interval or the ability to constrain source model parameters for a given source intensity. More subtle issues may also be explored: e. g. how sensitive a given observation may be to pulsed emission of a given flux and modulation depth, spatially extended emission or pointed versus survey mode observation scenarios.

The gtobssim tool (and realted gtorbsim tool) produced Fermi simulated data files. Which can then be analyzed with the science-tool following the same procedure as with the real data.

This tutorial assumes the user has an spacecraft data file already generated with the gtorbsim tool, or that he or she has obtained a sample spacecraft data file from the FSSC website (step 4). Alternatively, for basic zenith-rocking scenarios, one can be created "on the fly".


  1. Download the latest model for the isotropic background.

    To simulate the lastest isotropic model you will need to download the following files iso_p7v6source.txt, and isotropic_allsky.fits.

  2. Prepare XML source library files

    These are XML files containing the source model definitions used by gtobssim.

  3. Create a list of XML input file names

    Various XML source libraries already exist. In addition to creating custom libraries, you can make sources in these libraries available by including the full paths to the files in this list.

  4. Create a list of sources

    These are the sources to be modeled.

  5. Specify or create a pointing and livetime history file

    You can: use an existing pointing and livetime history file; create one using the gtorbsim tool; or define a pointing strategy and let gtobssim compute one.

  6. Run gtobssim

» Back to Top

1. Download the latest model for the isotropic background

When you use the lastest diffuse emission model gal_2yearp7v6_v0.fits in a likelihood analysis you will want to use the corresponding model for the isotropic diffuse emission, which includes the residual cosmic-ray background. To simulate the lastest isotropic model you will need to download the following files iso_p7v6source.txt and isotropic_allsky.fits. The isotropic spectrum is valid only for the P7SOURCE_V6 response functions and only for data sets with front + back events combined.

» Back to Top

2. Prepare the XML source library files

These files contain the XML definitions of the sources that are used by gtobssim These files by themselves are not valid XML documents, but rather they contain XML "source_library" tags that are compiled in memory into a valid XML document that is then parsed by the software. It should be noted that these files are analogous to, but unfortunately not compatible with gtlike xml source model files.

The following example shows how to define point sources with simple and broken power-law spectra, diffuse sources using FITS image files as a templates in two different ways, and an isotropic diffuse source.

The following xml files can be extracted from this document and edited with a text editor, or created with the model editor tool. Model editor creates models for gtobssim that are also available for gtlike. To use model editor tool type

prompt> modeleditor

in the command line. The tools has its own help.

In this example, we specified source parameters derived from the Thrid EGRET Catalog, and incorporating the current Fermi background models.

<source_library title="example_sources">

<source name="example_3C279" flux="0.0348">
<spectrum escale="MeV">
<particle name="gamma">
<power_law emin="20.0" emax="200000." gamma="1.96"/>
<celestial_dir ra="193.98" dec="-5.82"/>

<source name="example_3C273" flux="0.0196">
<spectrum escale="MeV">
<particle name="gamma">
<power_law emin="20.0" emax="200000." gamma="2.58"/>
<celestial_dir ra="187.25" dec="2.17"/>

<source name="crab_pulsar" flux="0.154">
<spectrum escale="MeV">
<particle name="gamma">
<power_law emin="20" emax="1000000." gamma="2.19" ebreak="1500" gamma2="4.89"/>
<celestial_dir ra="83.57" dec="22.01"/>

<source name="IsotropicDiffuse">
<spectrum escale="MeV">
<SpectrumClass name="FileSpectrumMap" params="flux=0.,fitsFile=isotropic_allsky.fits,specFile=iso_p7v6source.txt"/>
<use_spectrum frame="galaxy"/>

<source name="GalacticDiffuse">
<spectrum escale="MeV">
<SpectrumClass name="MapCube" params="gal2yearp7v6_v0.fits"/>
<use_spectrum frame="galaxy"/>

<source name="standard_diffuse_components">
<nestedSource sourceRef="GalacticDiffuse" />
<nestedSource sourceRef="IsotropicDiffuse" />


Other examples can be found in the Sources available to gtobssim section.

The name of the xml file should have the "xml" extension.

3. Create a list of XML input file names

When gtobssim is run, a list of XML input file names may be provided. This list is an ascii file giving full or relative paths to the XML files containing the source definitions. If this list is omitted (by entering "none"), then the following XML files are used by default:


If there is only one XML file, then the name of that file may be given rather than the ascii list.

4. Create a list of sources

This is an ascii file containing a list of the sources that are to be modeled. For example, assuming the above source_library is used, then to model 3C 279, 3C 273, and the interstellar and extragalactic diffuse components, this file would contain


Lines beginning with "#" are treated as comments.

5. Provide a pointing and livetime history file

One has the option of providing a pointing and livetime history file to gtobssim or letting gtorbsim calculate the spacecraft orbit and attitude. The pointing and livetime history file may be a FITS file with this format, or it may be an ascii file with a format defined by this code.

6. Run gtobssim

Assuming the above XML file is example_library.xml and that the list of sources is called source_names.dat, one can run gtobssim like this (for a one day long simulation):

prompt> gtobssim
File of flux-style source definitions[] example_library.xml
File containing list of source names[] source_names.txt
Pointing history file[] none
Prefix for output files[] test
Simulation time (seconds)[] 86400
Simulation start time (seconds wrt MET 0) INDEF
Apply acceptance cone?[] no
Response functions[] P7SOURCE_V6
Random number seed[] 293049
added source "example_3C279"
added source "example_3C273"
Generating events for a simulation time of 86400 seconds....

Note that the startdate parameter has been set to 2009-01-20. Since the photon arrival times are referred to the mission start date of 2001-01-01 00:00:00, the earliest possible photon arrival time in the resulting FT1 file would be 254102400 MET seconds. In the example no spacecraft data file was entered in "Pointing history file". In this case the spacecraft data file is generated directly by gtobssim and is named: test_scData_0000.fits . The event file is named in this case: test_events_0000.fits. The map that can be created using gtbin could be downloaded from here.

Related Tools

Last updated by: Elizabeth Ferrara 04/17/2012