Gammapy tutorial notebooks

What is this?

Set up

The Gammapy installation instructions are here: Installation

One quick way to get set up, that works the same on Linux, Mac and Windows is this:

  • Install Anaconda or Miniconda (see )

  • Get the following repository that contains the Gammapy tutorial notebooks:

    git clone
    export GAMMAPY_EXTRA=$PWD/gammapy-extra
  • Create a Python conda environment that contains all software used in the tutorials:

    cd gammapy-extra
    conda env create -f environment.yml
  • If you already have that environment, but want to update:

    conda env update -f environment.yml
  • Activate the environment and start Jupyter:

    source activate gammapy-tutorial
    cd notebooks
    jupyter notebook
  • Select and start the notebook you want in your webbrowser.

If you have any questions, ask for help. See

Execute tutorials online

If you want, you can execute latest version of the collection of notebooks on-line accessing the Gammapy Binder space.

Click the “launch binder” link here, or at the top of each notebook below:

Note that this is a free, temporary notebook server. You cannot upload your data or save your work there. For that, install Gammapy on your machine and work there.

The basics

Gammapy is a Python package built on Numpy and Astropy, and the tutorials are Jupyter notebooks. If you’re already familar with those, you can skip to the next section and start learning about Gammapy.

To learn the basics, here are a few good resources.


Scientific Python


For a quick introduction to Gammapy, go here:

Interested to do a first analysis of simulated CTA data?

To learn how to work with gamma-ray data with Gammapy:

2-dimensional sky image analysis:

1-dimensional spectral analysis:

3-dimensional cube analysis:

Time-related analysis:

Extra topics

These notebooks contain examples on some more specialised functionality in Gammapy.

Most users will not need them. It doesn’t make much sense that you read through all of them, but maybe browse the list and see if there’s something that could be interesting for your work (or contribute to Gammapy if something is missing!).

Work in progress

The following notebooks are work in progress or broken.

Please help make these better, or write new, better ones!