Fermi Science Support Center

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".

Steps:

  1. Download the latest model for the isotropic background.

    To simulate the lastest isotropic model you will need to download the following files isotropic_iem_v02.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 gll_iem_v02.fit 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 isotropic_iem_v02.txt and isotropic_allsky.fits. The isotropic spectrum is valid only for the P6_V3_DIFFUSE 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="_3C279" flux="0.0347857778772">

<spectrum escale="MeV">
<particle name="gamma">
<power_law emin="20.0" emax="1000000.0" gamma="1.96"/>
</particle>
<celestial_dir ra="193.98" dec="-5.82"/>
</spectrum>

</source>

<source name="_3C273" flux="0.0195836352338">
<spectrum escale="MeV">
<particle name="gamma">
<power_law emin="20.0" emax="1000000.0" gamma="2.58"/>
</particle>
<celestial_dir ra="187.25" dec="2.17"/>
</spectrum>
</source>

<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"/>
</particle>
<celestial_dir ra="83.57" dec="22.01"/>
</spectrum>
</source>

<source name="GalacticDiffuse_v02">
<!-- This is v02 of the diffuse emission model that is recommended by the Diffuse Group.
Total photon flux from the map (#/m^2/s) = 8.296 over the whole
energy range of the MapCube file (50 MeV-100 GeV) -->
<spectrum escale="MeV">
<SpectrumClass name="MapCube" params="8.296,$(FERMI_DIR)/refdata/fermi/galdiffuse/gll_iem_v02.fit"/>
<use_spectrum frame="galaxy">
</spectrum>
</source>

<!-- This is the isotropic diffuse spectrum that is recommended by the
the diffuse group for P6V3 DIFFUSE class FRONT + BACK; integrated
flux below is 5.01 ph m^-2 s^-1 [Note units] -->

<source name="IsotropicDiffuse_v02">
<spectrum escale="MeV">
<SpectrumClass name="FileSpectrumMap"
params="flux=5.01,fitsFile=isotropic_allsky.fits,
specFile=isotropic_iem_v02.txt,emin=39.3884,emax=403761"/>
<use_spectrum frame="galaxy"/>
</spectrum>
</source>

<source name="Standard_diffuse_components">
<nestedSource sourceRef="GalacticDiffuse_v02" />
<nestedSource sourceRef="IsotropicDiffuse_v02" />
</source>
</source_library>

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:

$(FERMI_DIR)/xml/fermi/observationSim/3EG_catalog_20-1e6MeV.xml
$(FERMI_DIR)/xml/fermi/observationSim/obsSim_source_library.xml
$(FERMI_DIR)/xml/fermi/GRBobs/GRB_user_library.xml

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

Standard_diffuse_components
_3C279
_3C273
#Crab_Pulsar

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[none] src_sim.xml
File containing list of source names[source_names.txt] source_names.dat
Pointing history file[none]
Prefix for output files[test] test
Simulation time (seconds)[86400]
Simulation start date[2001-01-01 00:00:00] 2009-01-20
Apply acceptance cone?[no]
Response functions[] P6_V3_DIFFUSE
Random number seed[293049]
added source "Standard_diffuse_components"
added source "_3C279"
added source "_3C273"
Generating events for a simulation time of 86400 seconds....
Done.
prompt>

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: Analia Cillis 08/24/2009