The most difficult tasks is how to set up your analysis environment correctly. Once that’s done running the analysis will be simple, because Enrico will help you.

You need to:

  • Install the Fermi ScienceTools
  • Install Enrico
  • Install additional (optional) python packages
  • Download Fermi data (photon and spacecraft files)
  • Download the diffuse model and 3FGL catalog files

Here we give some instructions on how to do these steps, but to be honest, if you don’t know how to install python packages (e.g. know what PYTHONPATH, and pip are), you might fail and will have to ask someone at your institute for help.

Install the Fermi ScienceTools

The first step is to get the Fermi Science Tools

Download and install the Fermi Science Tools as described here. Best option is to download the binnary and unzip them

Set up your shell (we are assuming bash throughout) for Fermi analysis. The first thing to do is to setup a environment variable ‘FERMI_DIR’. This variable must point to the folder where the ‘’ script is. For exemple for the v10r0p5 version of the ST and the SL6 binary you have :

export FERMI_DIR = /Where/I/put/the/ST/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.12/x86_64-unknown-linux-gnu-libc2.12
source $FERMI_DIR/

An ‘ls’ command in the FERMI_DIR should give you something like :

BUILD_DIR  build  etc     help   include  macros  refdata  syspfiles  tutorials
bin        cint   fermi-init.csh  fonts

Check that you have access to the Fermi command line tools and python packages:


If there is no error message, the ST are installed.

>>> import UnbinnedAnalysis

If there is no error message, the python support of ST is installed.

Install Enrico

Get the enrico package

git clone

Again you have to setup an environment variable name ENRICO_DIR which point to the enrico folder. After the clone type

cd enrico

or alternatavely

export ENRICO_DIR=/Where/I/put/Enrico/enrico/

An ‘ls’ command in the ENRICO_DIR should give you something like :

CHANGES.txt  LICENSE.txt  README.rst  bin  doc  enrico  enrico-init.csh  script

The last step is to source the init file:

source $ENRICO_DIR/

This command will setup you PATH and PYTHONPATH variable to have access to the enrico tools. Run the following command to check the status of your analysis environment:


Build the documentation if you like:

cd doc
make html
firefox build/html/index.html

Install additional (optional) python packages


You don’t have to install all of the following packages, but if you do you’ll have a much nicer and more powerful python environment.

configobj is used throughout and you really need it, other packages are optional or come with the ST

You’ll get an ImportError with the name of the missing package once you try to use part of the code that relies on that package.

First of all you should install setuptools and pip as described here, because pip makes it easy to install additional packages. To install both just run:

curl -O
which pip # should be located in the Fermi software
pip # should print a help message

Next install ipython, which is a much nicer interactive python shell than the default python shell and configobj, which is a more powerful config file reader and is user by Enrico instead of the ConfigParser from the python standard library. nose <>__ is a python test runner, used e.g. by `numpy.test(). Sphinx is the python documentation generator and we also use it for this project:

pip install ipython
pip install configobj
pip install nose
pip install sphinx

Now update to a recent Numpy and Scipy. The Fermi tools ship with a very old Numpy (version 1.4.1) and no Scipy (even though scipy is used e.g. in

pip install numpy
pip install scipy


Numpy and Scipy have many C and Fortran extensions and compiling those can fail. In that case you have to download the packages and build them yourself, adjusting some build options to your system.

git clone
cd numpy
python build <options for your system here>

Finally install some nice and useful python packages:

  • Kapteyn is great for working with coordinates and plotting images,
  • ATpy has a nicer API for working with tables than pyfits
  • uncertainties makes error propagation dead simple.
pip install
pip install atpy
pip install uncertainties

Download Fermi data (photon and spacecraft files)

There are two options. If you are only analysing one ore two targets, you can download the data for these targets specifically from the FSSC dat server.

If you are doing many analyses or survey work, you should download the complete data set, i.e. one global spacecraft file and weekly photon files from the FSSC FTP server.

Actually Enrico will help you working with the weekly files. Just set the following environment variable to wherever you’d like the spacecraft file and weekly photon files to be:

FERMI_DATA = <somewhere with ~20 GB storage space>

Then running the following command will download the data in an incremental manner

enrico_download --download_data

This will run wget to update only the weekly files that are necessary and download a spacecraft file for the whole mission (~ 500 MB). There is no documented method to combine weekly spacecraft files.

Obviously you should share one software and data installation per institute and not hit the FSSC servers without need.

Download the diffuse model and 3FGL catalog files

The diffuse model and 3FGL catalog files can be downloaded from the FSSC

Enrico uses the following environment variables to find the catalog and diffuse model files


They are set automatically but you can change the default value and run the following command to download any missing files from the FFSC

enrico_download  --download_aux

This will also download the Template files for the analysis of extended sources.


  • Building from source doesn’t work on the MPIK cluster or on my Mac.
  • Importing pyIrfLoader might fail if pyLikelihood hasn’t been imported first. So if you ever see that error, look at the traceback where it happens and replace
>>> import pyIrfLoader


>>> import pyLikelihood
>>> import pyIrfLoader