Bruno Khélifi

Open science to analyse astrophysical high-energy data with Gammapy (tutorial)

Welcome to a tutorial on Gammapy within the subjects of astroparticle physics and computer science.

Title: Open science to analyse astrophysical high-energy data with Gammapy (tutorial)
Lecturer: Dr Bruno Khelifi, Astroparticule et Cosmologie Laboratory, Paris, France


To participate in the tutorial, please register using this form.

Learn more about Gammapy

At 10.30-11.30 am in the morning, there will be a seminar where you can learn more about Gammapy.

More about the content

This tutorial will introduce Gammapy, a Python open-source software package to model and fit high-energy data. The tutorial will go through steps of installation of Gammapy, the prerequisites to analyse TeV and GeV data, and analysis of different high-energy data such as HESS, CTA or Fermi-LAT.


  • Installation of Gammapy
  • Basic notions of Python and its environment
  • Introduction of the TeV astronomy analysis techniques
  • Realisation of sky maps and fit of energy spectra
  • Introduction of 3D analysis
  • Modeling and fit of a Crab nebula dataset from Fermi-LAT, HESS, Veritas, Magic, Fact


The advent of multi-messenger astronomy is a game changer in astrophysics. Observations at various photon wavelengths (from radio to gamma-rays) and using new messengers such as gravitational waves (GW) or neutrinos provide a huge volume of data with their own instrumental specificity and attributes, and as well a large variety of insights and constraints on physical processes at play in the Universe.

The discovery of a very high energy (~290 TeV) neutrino in spatial and temporal coincidence with a flare of the gamma-ray blazar TXS 0506+056 suggests that, at least some, blazars accelerate heavy particles in the PeV (10^15 eV) range and beyond. This reinforces the likelihood that some ultra-high energy cosmic-rays (UHECRs) are produced in these objects. This suggests that the underlying phenomena are complex and understanding them will require detecting more of these objects. Similarly, a major missing link in our knowledge of Galactic Cosmic-Rays (CGR) is the nature of PeV accelerators in the Galaxy. But this will again require detailed gamma-ray measurements such as those provided by Fermi-LAT, HESS, HAWC and soon from the Cherenkov Telescope Array (CTA) that will provide excellent sensitivity from tens of GeV to ~100 TeV. Key questions of high energy astrophysics must be tackled with multi-messenger astronomy.

Nowadays, most of the modeling work is done currently using some reduced very high-level information such as flux points, light curves etc. This limits very strongly the impact and the extent of any study. High energy instruments, such as gamma-ray and neutrino telescopes, operate in a regime of low and very low count statistics. They usually operate in complex environments yielding large uncertainties in the instrument responses and systematic effects in the measurements. All this information is lost when the data used for modeling are in a very high-level reduced format, such as flux points.

The capability to properly test and constrain a detailed multi-wavelength and multi-messenger model requires a forward-folding approach where the model is convolved with each instrument response function to predict numbers of expected events and compare them to the observed ones with a detailed statistical treatment such as maximum likelihood. This now becomes possible thanks to the partial public release of data by instruments such as Fermi-LAT and HESS.

The missing ingredient was a data modeling and fitting environment to perform simultaneous fitting on the various reduced datasets and to provide relevant physical constraints taking into account statistical and systematic uncertainties in a proper manner.

Gammapy is an open-source Python package for gamma-ray astronomy built on Numpy and Astropy libraries developed mainly in France, Germany and Spain. It is a prototype for the CTA Science Tools and can be used to analyze data from existing gamma-ray telescopes such as HESS. It performs data reduction for gamma-ray instruments as well as data modeling and fitting.

This tutorial will introduce how to use Gammapy, with high-level real data or simulated datasets, from its installation to the modeling and fit of multi-instrument datasets.

Target audience

Designed as a Science Tools package for the CTA observatory (from ~10GeV to ~300TeV), Gammapy aims to be used by any student and physicist willing to use TeV high-level data, being expert or not of the TeV astronomy techniques. As consequence, this tutorial is for any person interested by the exploration of such astrophysical data, from master students to professors.


Infrastructure for the tutorial

Your personal laptop and a network connection during the tutorial (local network or eduroan). The recommended way to install Gammapy is to install before the tutorial the Anaconda distribution (from


About the author

Bruno Khélifi is a permanent researcher in the laboratory APC, AstroParticules et Cosmologie, of IN2P3/CNRS - Université de Paris. He obtained his PhD in 2002 by working on the CAT telescope, a French TeV detector in the French Pyrénées, in the Collège de France. After realised a Post-doctoral fellowship in MPIK-Heidelberg on the HESS experiment, he entered CNRS in 2005.

He is an experimentalist who has worked on the CAT, HESS and CTA projects, on instrumental sub-projects, detector designs, software packages building. His scientific researches are focused on the acceleration processes of high-energy particles in action within galactic objects, mainly Pulsar Wind Nebulae. His current activities are centered on the search of PeVatrons, ie accelerators of leptonic or hadronic particles up to the knee(s) energies around 10^15eV.