Gammapy analysis workflow and package structure#

Analysis workflow#

Fig. 1 illustrates the standard analysis flow and the corresponding sub-package structure of Gammapy. Gammapy can be typically used with the configuration based high level analysis API or as a standard Python library by importing the functionality from sub-packages. The different data levels and data reduction steps and how they map to the Gammapy API are explained in more detail in the following.


Fig. 1 Data flow and sub-package structure of Gammapy. The folder icons represent the corresponding sub-packages. The direction of the the data flow is illustrated with shaded arrows. The top section shows the data levels as defined by CTA.#

Analysis steps#

Data access and selection (DL3)

The analysis of gamma-ray data with Gammapy starts at the “data level 3”. At this level the data is stored as lists of gamma-like events and the corresponding instrument response functions (IRFs).

Instrument Response Functions (DL3)

Gammapy supports various forms of instrument response functions (IRFs), which are represented as multidimensional data classes.

Data reduction (DL3 to DL4)

The events and instrument response are projected and binned onto the selected geometry. To limit uncertainties, additional background estimation methods are applied and “safe” data analysis range is determined.

Sky maps (DL4)

Gammapy represents data on multi-dimensional maps which are defined with a geometry representing spatial and spectral coordinates. The former can be a spherical map projection system or a simple sky region.

Datasets (DL4)

The datasets classes bundle reduced data in form of maps, reduced IRFs, models and fit statistics and allow to perform likelihood fitting. Different classes support different analysis methods and fit statistics. The datasets are used to perform joint-likelihood fitting allowing to combine different measurement.

Modeling and Fitting (DL4 to DL5)

Gammapy provides a uniform interface to multiple fitting backends to fit the datasets model parameters on the reduced data with maximum likelihood techniques.

Estimators (DL4 to DL5, and DL6)

In addition to the global modelling and fitting, Gammapy provides utility classes to compute and store flux points, light curves and flux as well as significance maps in energy bands.

Configurable analysis#

High Level Analysis Interface

To define and execute a full data analysis process from a YAML configuration file, Gammapy implements a high level analysis interface. It exposes a subset of the functionality that is available in the sub-packages to support standard analysis use case in a convenient way.

Command line tools

A minimal command line interface (CLI) is provided for commonly used and easy to configure analysis tasks.

Additional utilities#

Source catalogs

Access to a variety of GeV-TeV gamma-ray catalogs.

Statistical utility functions

Statistical estimators, fit statistics and algorithms commonly used in gamma-ray astronomy.


Support for simulation of TeV source populations and dark matter models.


Helper functions and classes to create publication-quality images.

Utility functions

Utility functions that are used in many places or don’t fit in one of the other packages.