Getting started#


There are various ways for users to install Gammapy. We recommend setting up a virtual environment using either conda or mamba. Here are two methods to quickly install Gammapy.

Working with conda?

Gammapy can be installed with Anaconda:

conda install -c conda-forge gammapy
Prefer pip?

Gammapy can be installed via pip from PyPI.

pip install gammapy
In-depth instructions?

Update existing version? Working with virtual environments? Installing a specific version? Check the advanced installation page.

Learn more

Tutorials Overview#

Gammapy can read and access data from multiple gamma-ray instruments. Data from Imaging Atmospheric Cherenkov Telescopes, such as CTA, H.E.S.S., MAGIC and VERITAS, is typically accessed from the event list data level, called “DL3”. This is most easily done using the DataStore class. In addition data can also be accessed from the level of binned events and pre-reduced instrument response functions, so called “DL4”. This is typically the case for Fermi-LAT data or data from Water Cherenkov Observatories. This data can be read directly using the Map and IRFMap classes.

CTA data tutorial HESS data tutorial Fermi-LAT data tutorial

Gammapy lets you create a 1D spectrum by defining an analysis region in the sky and energy binning using RegionGeom object. The events and instrument response are binned into RegionNDMap and IRFMap objects. In addition you can choose to estimate the background from data using e.g. a reflected regions method. Flux points can be computed using the FluxPointsEstimator.


1D analysis tutorial 1D analysis tutorial with point-like IRFs 1D analysis tutorial of extended sources

Gammapy treats 2D maps as 3D cubes with one bin in energy. Computation of 2D images can be done following a 3D analysis with one bin with a fixed spectral index, or following the classical ring background estimation.


2D analysis tutorial 2D analysis tutorial with ring background

Gammapy lets you perform a combined spectral and spatial analysis as well. This is sometimes called in jargon a “cube analysis”. Based on the 3D data reduction Gammapy can also simulate events. Flux points can be computed using the FluxPointsEstimator.


3D analysis tutorial 3D analysis tutorial with event sampling

Gammapy allows you to compute light curves in various ways. Light curves can be computed for a 1D or 3D analysis scenario (see above) by either grouping or splitting the DL3 data into multiple time intervals. Grouping mutiple observations allows for computing e.g. a monthly or nightly light curves, while splitting of a single observation allows to compute light curves for flares. You can also compute light curves in multiple energy bands. In all cases the light curve is computed using the LightCurveEstimator.

Light curve tutorial Light curve tutorial for flares

Gammapy offers the possibility to combine data from multiple instruments in a “joint-likelihood” fit. This can be done at multiple data levels and independent dimensionality of the data. Gammapy can handle 1D and 3D datasets at the same time and can also include e.g. flux points in a combined likelihood fit.

Combined 1D / 3D analysis tutorial SED fitting tutorial