Review: LAT Data Analysis

Compare: pyLikelihood - Unbinned and Binned Analysis

Perform:

  1. Setup: SLAC Central Linux
  1. Get Data (using the Astro Server)
  1. UnbinnedAnalysis
    a.) Prerequisite Science Tools: UnbinnedAnalysis

    b.) pyLikelihood: UnbinnedAnalysis
  1. BinnedAnalysis
    a.) Prerequisite Science Tools: BinnedAnalysis

    b.) pyLikelihood: BinnedAnalysis
  1. Interactively Explore pyLikelihood Functions

Example: gt_apps python Script Used in Binaries RSP Analysis; (For more examples, see Richard Dubois' confluence page "Scripts used in Binaries RSP Analysis".

See pyLikelihood:

Also see:

pyLikelihood Unbinned and Binned Analyses

Notice: The Fermi code has not been released to the public and is for use by members of the LAT Collaboration only!

The pyLikelihood package enables you to write a python script that, in its simplest form, reads in a source model and the event and spacecraft data files, then determines the goodness of fit, i.e., how well the model fits the data. The package is an interface to underlying code written in C or C++ that enables you to perform either an unbinned or a binned analysis by running gtlike, thereby making it an interface to the gtlike tool as well.

The UnbinnedAnalysis.py and BinnedAnalysis.py modules each contain two classes: UnbinnedObs and UnbinnedAnalysis in the former, and BinnedObs and BinnedAnalysis in the latter. Since the respective analyses require different sets of input data, the "Obs" classes differ in how they are constructed.

Notes:

  • To better understand the terms and concepts used in this Fermi LAT pyLikelihood tutorial, it is highly recommended that you first perform the Likelihood: Unbinned and the Likelihood: Binned tutorials.

Comparison of Unbinned and Binned
Analysis Classes and Objects

The UnbinnedAnalysis and BinnedAnalysis constructors are identical except that the BinnedAnalysis constructor takes an instance of BinnedObs as the observation object.

Factoring into separate analysis and observation classes affords flexibility in mixing and matching observations and models in a single Python session or script while preserving computational resources, so that one can do something like this:

>>> analysis1 = UnbinnedAnalysis(unbinnedObs, "model1.xml")  
>>> analysis2 = UnbinnedAnalysis(unbinnedObs, "model2.xml")

Even though the two UnbinnedAnalysis instances access the same data in memory, distinct source models may be fit concurrently to those data without interfering with one another. This is useful in comparing, via a likelihood ratio test, for example, how well one model compares to another.

Analysis Classes

Parameters: UnbinnedAnalysis

observation – An instance of the UnbinnedObs class.

srcModel – Name of the XML file containing the source model definition.

optimizer – Optimizer package to use: DRMNFB, DRMNGB, MINUIT, NEWMINUIT, LGFGS. (See Model Fitting.)

Parameters:
BinnedAnalysis

binnedData – An instance of the BinnedObs class.

srcModel – Name of the XML file containing the source model definition.

optimizer – Optimizer package to use: DRMNFB, DRMNGB, MINUIT, NEWMINUIT, LGFGS (see Model Fitting in gtlike Help file.)

Objects

UnbinnedObs(object)

eventfile – Event data; can be:

  • Single file name.
  • Tuple.
  • List of file names.

scFile – Spacecraft data; can be:

  • File name.
  • ASCII file of FITS names.

expCube – created using gtltcube

expMap – created using gtexpmap; required input includes expCube (created using gtltcube, see above)

irfs – e.g., P6_V3_DIFFUSE

checkCuts – Debugging flag; set to True for a standard analysis.

BinnedObs(object)

expCube.fits - created using gtltcube

binned-expMap.fits - created using gtexpcube2; required input:

3D Counts Map (gtbin - CCube)

srcMap.fits - created using gtsrcmaps; required inputs:

  • expCube.fits (gtltcube)
  • binned-expMap.fits (gtexpcube2)
  • 3D Counts Map (gtbin - CCube)
  • srcModel.xml

irfs – e.g., P6_V3_DIFFUSE

Note: The instrument response (PSF, effective area, energy resolution) is currently a function of energy, inclination angle (the angle between the source and the LAT normal), and photon category. Since the LAT usually surveys the sky, a source will be observed at different inclination angles. Each count will therefore be characterized by a different IRF. (See the Instrument response functions page in Confluence. )

Owned by: Jim Chiang
Last updated by: Chuck Patterson 04/01/2011