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 https://www.anaconda.com/download/ )

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

    git clone https://github.com/gammapy/gammapy-extra.git
    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 http://gammapy.org/contact.html

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?

3-dimensional cube analysis:

2-dimensional sky image analysis:

1-dimensional spectral analysis:

Time-related analysis:

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

  • For IACT data, see the cta_1dc_introduction notebook mentioned above.
  • Fermi-LAT data with Gammapy (Fermi-LAT data example) | data_fermi_lat.ipynb

Extra topics

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

Work in progress

The following notebooks are work in progress or broken.

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